Friday, 15 January 2010

haskell - Check wreq request headers -


I'm very new in Haskell and I'm not sure how I can get it. I am using as an HTTP client and I want to know which HTTP header is being sent to the server. For example, I have defined the following method, which can be used to authenticate the use of Facebook credentials. Attempts:

  Authentication ⦂ String → String → IO (Response biotechring) certify facebookId facebookToken = postWith opts "https: // Api.somedomain.com/auth" (object $ [" Facebook_token ". = FacebookToken, "Facebook_id". = FacebookId]) where opts = defaults & amp; Header "Content-Type" ~ ["Application / JS"] & amp; Header "Accept" ~ ["App / JS"] & amp; Proxy? ~ HttpProxy "localhost" 9396  

I get a proper response with POSTMAN, but I get unauthorized access to wreq (403) I think that something Additional requests can be added by the header library and this is what I want to see.

Any hint?

EDIT: An HTTP proxy now does not know HTTP traffic ( wreq though request).

In Wreq, type options type show There is an example, so that you can pass it or just observe it on ghci:

  ghci & gt; Import the network. Default :: option option {manager = left _, proxy = none, opus = nothing, header = [("user-agent", "haskell verac -0.3.0.1")], parameters = [], redirects = 10 , Cookies = []}  

You can also use the lens to focus directly on the header:

  ghci & gt; Omission ^. Header [post]  followed by  code> (if it is adding some headers to Wreq) [["user-agent", "Haskell Verac -0.3.0.1"]]  

With , you will need to use a web debugging proxy as if it is coming to know what's happening.


No comments:

Post a Comment