I am trying to add headers in our SS service using the APIMember attribute with ParameterType = "header".
Everything seems to be working except the header which is not getting added to the RequestContext. Hoping it supports headers. If it does, how and is there a way to not allow that header property in the Get query or path?
What am I doing wrong?
namespace Test
{
[Api(Description = "MyTest")]
[Route("/Test", Verbs="GET")]
public class MyRequest
{
[ApiMember(
Name = "SolutionName",
ParameterType = "query",
Description = "Test",
DataType = "string",
IsRequired = true)]
public string SolutionName { get; set; }
[ApiMember(
Name = "Token",
ParameterType = "header",
DataType = "string",
IsRequired = true)]
public string Token { get; set; }
}
}
Help appreciated!
Thanks, Nac
So, looking here it appears that header parameters are not supported by default and you need to set supportHeaderParams = true
. The NuGet install of ServiceStack.Api.Swagger has supportHeaderParams = false
. You can change this variable in the index.html file that is located in the /swagger-ui
folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With