pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/gdwrd/mruby-smallhttp

e0.css" /> GitHub - gdwrd/mruby-smallhttp: mruby-smallhttp for mruby · GitHub
Skip to content

gdwrd/mruby-smallhttp

Repository files navigation

mruby-smallhttp

Build Status

mruby-smallhttp for mruby

install by mrbgems

mruby-smallhttp it's small http lib for MRuby

Install by mrbgems

  • add conf.gem line to build_config.rb
MRuby::Build.new do |conf|
  conf.gem :mgem => 'mruby-smallhttp'
end

Example

Requests

# GET Request
HTTP.new("https://example.com/api/v1/users").get
#=> response

# POST Request
data = { name: 'value' }
headers = {'Content-Type' => 'application/json'}

HTTP.new("https://example.com/api/v1/users").post(data, headers)
#=> response

# PUT Request
http = HTTP.new("https://example.com/api/v1/users/1")
http.put(data, headers)

# DELETE Request
http = HTTP.new("https://example.com/api/v1/users/1")
http.delete(data, headers)
#=> response

# HEAD & OPTIONS Request
http = HTTP.new("https://example.com/api/v1/users/1")
http.request("HEAD", body, header)
#=> response

How to send file

# How to send file in post request
body = { name: 'value', file: File.read('filename') }
header = { 'Content-Type' => 'multipart/form-data' }
http = HTTP.new("https://example.com/api/v1/users/1")
http.post(body, header)
#=> response

Content-Type supported: application/json, application/x-www-form-urlencoded, multipart/form-data and text/plain

License

under the MIT License:

  • see LICENSE file

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy