PUT HTTP request with http enumerator

I would like to use the http-enumerator package to execute not only GET / POST, but also PUT.

HTTP enumerator:
http://hackage.haskell.org/package/http-enumerator
http://hackage.haskell.org/packages/archive/http-enumerator/0.6.5/doc/html/Network-HTTP-Enumerator.html

*) my first step was to build a request and print it.
However, I was unable to write the correct Show function (error "There is no instance for Show .. associated with the use of printing").

*) next I think I need to use the function "httpLbs :: MonadIO m => Request m β†’ Manager β†’ m Response" to get the answer.

for people who are looking for and need this information: haskell, REST or quiet request, http, rest api access

+4
source share
1 answer

http-enumerator / http-conduit doesn't matter if you use POST, PUT, DELETE, etc. You just need to change the method entry of the Request data type. It is best to rely on OverloadedStrings for this, for example:

 {-# LANGUAGE OverloadedStrings #-} import Network.HTTP.Enumerator main = do req <- parseUrl "http://www.example.com/put-url" withManager $ httpLbs req { method = "PUT" } 

NTN

+5
source

All Articles