Question about ApiHeaderParameter

Hello.

To test ApiHeaderParameter, invoked HttpApi service method like this

curl ... -H "x-my-secret-key: somethingsecret" http://localhost:8099/api/test

and to read x-my-secret-key header value at server, I tried following code but I couldnt’

[ServiceMethod]
[ApiMethod(HttpApiPath = "test", HttpApiMethod = ApiRequestMethod.Get)]
public string MyTestApi ([ApiHeaderParameter]string mySecretKey)
and
public string MyTestApi ([ApiHeaderParameter]string xMySecretKey)

How can server read x-my-secret-key header value?

1 Like

Hello

The name of the header should be X-mySecretKey (not case-sensitive) . I’ll log an issue to handle header names like X-my-Secret-Key (with dashes) as well.

You can drop a mail to support@ with your account name on remobjects.com and we’ll provide you a preliminary build with this update and (probably) update for the topic Getting a client ip address in HttpApi Service

Regards

1 Like

Logged as bugs://D19187.

Thank you!!!

bugs://D19187 was closed as fixed.