Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ServiceStack JsonServiceClient - Custom HTTP Headers not sent

Tags:

servicestack

I'm trying to send custom HTTP Headers with a JsonServiceClient but headers are never sent in the query.

I'm using:

JsonServiceClient client = new JsonServiceClient (baseUri);
client.Headers.Add ("X-Parse-Application-Id", "XXXXXX");
client.Headers.Add ("X-Parse-REST-API-Key", "XXXXXX");

Any idea ?

like image 260
Greg Avatar asked Jul 12 '13 11:07

Greg


1 Answers

You haven't made a request yet. The Headers get added here when you make a request.

An alternative way to add headers is to use the Request filters, e.g:

client.RequestFilter = httpReq => {
    httpReq.Headers.Add ("X-Parse-Application-Id", "XXXXXX");
    httpReq.Headers.Add ("X-Parse-REST-API-Key", "XXXXXX");
};

Which effectively does the same thing.

like image 159
mythz Avatar answered Nov 15 '22 03:11

mythz