Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send some data in http header with restkit

Tags:

ios

restkit

I need send some data in http header each time when I do request to server (whith get and post methods). I am using RKObjectManager from restkit. Also I need check status returned by server (401, 200, 404 e.t.c). Does anybody know the solution?

Thanks!

like image 910
Radislav Avatar asked Jul 03 '12 16:07

Radislav


2 Answers

in version 0.20.0rc1 you can use the following code:

[[[RKObjectManager sharedManager] HTTPClient] setDefaultHeader:myHeaderName value:myValue];
like image 85
Dmitry Khryukin Avatar answered Nov 03 '22 10:11

Dmitry Khryukin


If you need to send custom headers with your requests, i'd suggest to use the RKClient property HTTPHeaders, for example:

[[[[RKObjectManager sharedManager] client] HTTPHeaders] setValue:myValue
                                                          forKey:myHeaderName];

For the status code, see my another answer.

like image 16
mja Avatar answered Nov 03 '22 11:11

mja