icyleaf / halite

💎HTTP Requests Client with a chainable REST API, built-in sessions and middlewares.
MIT License
170 stars 13 forks source link

feat: request raw string support (#20) #22

Closed icyleaf closed 6 years ago

icyleaf commented 6 years ago

related to #20

Use the raw argument to pass raw string as body:

r = Halite.post("http://httpbin.org/post", raw: "name=Peter+Lee&address=%23123+Happy+Ave&Language=C%2B%2B")
r.parse
# => {"args" => {}, "data" => "{\"a\":\"n\"}", "files" => {}, "form" => {}, "headers" => {"Accept" => "*/*", "Accept-Encoding" => "gzip, deflate", "Connection" => "close", "Content-Length" => "9", "Content-Type" => "application/json", "Host" => "httpbin.org", "User-Agent" => "Halite/0.4.0"}, "json" => {"a" => "n"}, "origin" => "60.206.194.34", "url" => "http://httpbin.org/post"}