ios - printing NSURLRequest body/query always prints null -


i'm making web requests using afnetworking. subclassed nsurlprotocol , method swizzled override default nsurlsessionconfiguration , add protocol class intercept web requests. when caninit called try print request data, want body , query prints null both. know requests being correctly intercepted don't have body/query data. know why is? how go getting body data?

so after doing research found apple docs nsurlrequests body , bodystream:

the receiver have either http body or http body stream, 1 may set request. http body stream preserved when copying nsurlrequest object, lost when request archived using nscoding protocol.

so, after checking httpbodystream found actual body being stored. had copy input stream, convert data, convert string , print. here's reference on how did that:

how convert nsinputstream nsstring or how read nsinputstream


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -