nice_http 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +331 -325
  3. data/lib/nice_http.rb +1188 -1195
  4. data/lib/nice_http/utils.rb +109 -109
  5. metadata +32 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e13c6fcc544ad6f967b3d4a4d9f0efd945b798e7acf2caa5edefcc764902c1e0
4
- data.tar.gz: b0b66d1cf1951a94b3d032774990f29d40dd6036ff54f313b8155c1d862d5299
3
+ metadata.gz: 2a5130a17c74e266e3867624db6c52cb602ce96af5c8abc318b4e90fd90769d0
4
+ data.tar.gz: a99c7f2aa2e61c2eb5436d28ac7c6fa5e01087a85cd62c984bf53cfce33d9864
5
5
  SHA512:
6
- metadata.gz: af513dc9bafc301fed7f282f4472c6c8f1449a01c0bd82de7d7fece8baa26df169767ee08697907a41d927a89b17f49fad4a3ab85ff99c02148fef676b780faa
7
- data.tar.gz: 35a853fc116ba4c56d21ce006108db0b950789d6917f7bba1a70289821cbab1456658ede6eb7ca2f00843b5c7ef59b95b91f3817a8f81257f90a5cd9dfbaf444
6
+ metadata.gz: fa7f863a14d48983d188265d44f01c05a18206ac8a656c61ed0c18bc9bad1280dbdc1bb7999c078fbe490811f3192c03c96387f81c8c5872f6dc0c89ce6b563e
7
+ data.tar.gz: '05739e8ecfa8f834df126c10b179420a461b2791b96e0e0e03ae3a9924b72c76c9f930eed83c49b2d43ac33c8d2800f9b02f8566a3defa2a171b0802d949e484'
data/README.md CHANGED
@@ -1,325 +1,331 @@
1
- # NiceHttp
2
-
3
- [![Gem Version](https://badge.fury.io/rb/nice_http.svg)](https://rubygems.org/gems/nice_http)
4
-
5
- NiceHttp the simplest library for accessing and testing HTTP and REST resources.
6
-
7
- Manage different hosts on the fly. Easily get the value you want from the JSON strings. Use hashes on your requests.
8
-
9
- Also you can use mock responses by using :mock_response key on the request hash and enable the use_mocks option on NiceHttp.
10
-
11
- NiceHttp will take care of the redirections and the cookies, and for security tests you will be able to modify the cookies or disable and control the redirections by yourself.
12
-
13
- To be able to generate random requests take a look at the documentation for nice_hash gem: https://github.com/MarioRuiz/nice_hash
14
-
15
- Example that creates 1000 good random and unique requests to register an user and test that the validation of the fields are correct by the user was able to be registered. Send 800 requests where just one field is wrong and verify the user was not able to be created: https://gist.github.com/MarioRuiz/824d7a462b62fd85f02c1a09455deefb
16
-
17
- ## Installation
18
-
19
- Install it yourself as:
20
-
21
- $ gem install nice_http
22
-
23
-
24
- ## A very simple first example
25
-
26
- ```ruby
27
- require 'nice_http'
28
-
29
- http = NiceHttp.new('https://reqres.in')
30
-
31
- resp = http.get("/api/users?page=2")
32
-
33
- pp resp.code
34
- pp resp.data.json
35
-
36
- resp = http.get("/api/users/2")
37
-
38
- pp resp.data.json(:first_name, :last_name)
39
-
40
- resp = http.post( {
41
- path: "/api/users",
42
- data: { name: "morpheus", job: "leader" }
43
- } )
44
-
45
- pp resp.data.json
46
- ```
47
-
48
- ## Create a connection
49
-
50
- The simplest way is just by supplying the value as an argument:
51
-
52
- ```ruby
53
-
54
- # as an url
55
- http1 = NiceHttp.new("https://example.com")
56
-
57
- # as parameters
58
- http2 = NiceHttp.new( host: "reqres.in", port: 443, ssl: true )
59
-
60
- # as a hash
61
- http3 = NiceHttp.new my_reqres_server
62
-
63
-
64
- ```
65
-
66
-
67
- You can specify all the defaults you will be using when creating connections by using the NiceHttp methods, in this example, http1 and http2 will be connecting to reqres.in with the default parameters and http3 to example.com:
68
-
69
- ```ruby
70
-
71
- # default parameters
72
- NiceHttp.host = 'reqres.in'
73
- NiceHttp.ssl = true
74
- NiceHttp.port = 443
75
- NiceHttp.debug = false
76
- NiceHttp.log = "./my_logs.log"
77
- NiceHttp.headers = {"api-key": "the api key"}
78
-
79
- http1 = NiceHttp.new()
80
-
81
- http2 = NiceHttp.new()
82
-
83
- http3 = NiceHttp.new("https://example.com")
84
-
85
- ```
86
-
87
- If you prefer to supply a hash to change the default settings for NiceHttp:
88
-
89
- ```ruby
90
- NiceHttp.defaults = {
91
- host: 'reqres.in',
92
- ssl: true,
93
- port: 443,
94
- debug: false,
95
- log: "./my_logs.log",
96
- headers: {"api-key": "the api key"}
97
- }
98
- ```
99
-
100
-
101
- ## Creating requests
102
-
103
- You can use hash requests to simplify the management of your requests, for example creating a file specifying all the requests for your Customers API.
104
-
105
- The keys you can use:
106
-
107
- *path*: relative or absolute path, for example: "/api2/customers/update.do"
108
-
109
- *headers*: specific headers for the request. It will include a hash with the values.
110
-
111
- *data*: the data to be sent for example a JSON string. In case of supplying a Hash, Nice Http will assume that is a JSON and will convert it to a JSON string before sending the request and will add to the headers: 'Content-Type': 'application/json'
112
-
113
- *mock_response*: In case of use_mocks=true then NiceHttp will return this response
114
-
115
-
116
- Let's guess you have a file with this data for your requests on */requests/example.rb*:
117
-
118
- ```ruby
119
-
120
- module Requests
121
-
122
- module Example
123
-
124
- # simple get request example
125
- def self.list_of_users()
126
- {
127
- path: "/api/users?page=2"
128
- }
129
- end
130
-
131
- # post request example using a request hash that will be converted automatically to a json string
132
- def self.create_user_hash()
133
- {
134
- path: "/api/users",
135
- data: {
136
- name: "morpheus",
137
- job: "leader"
138
- }
139
- }
140
- end
141
-
142
- # post request example using a JSON string
143
- def self.create_user_raw()
144
- {
145
- path: "/api/users",
146
- headers: {"Content-Type": "application/json"},
147
- data: '{"name": "morpheus","job": "leader"}'
148
- }
149
- end
150
-
151
- end
152
-
153
- end
154
-
155
- ```
156
-
157
-
158
- Then in your code you can require this request file and use it like this:
159
-
160
- ```ruby
161
-
162
- resp = http.get Requests::Example.list_of_users
163
-
164
- pp resp.code
165
-
166
- resp = http.post Requests::Example.create_user_hash
167
-
168
- pp resp.data.json
169
-
170
-
171
- resp = http.post Requests::Example.create_user_raw
172
-
173
- pp resp.data.json(:job)
174
-
175
-
176
- ```
177
-
178
-
179
- In case you want to modify the request before sending it, for example just changing one field but the rest will be the same, you can supply a new key :values_for in the request hash that will contain a hash with the keys to be changed and NiceHttp will perform the necessary changes at any level:
180
-
181
- ```ruby
182
-
183
- req = Requests::Example.create_user_hash
184
- req.values_for = {job: "developer"}
185
-
186
- resp = http.post req
187
-
188
- pp resp.data.json
189
- #response: {:name=>"morpheus", :job=>"developer", :id=>"192", :createdAt=>"2018-12-14T14:41:54.371Z"}
190
-
191
- ```
192
-
193
- ## Responses
194
-
195
- The response will include at least the keys:
196
-
197
- *code*: the http code response, for example: 200
198
-
199
- *message*: the http message response, for example: "OK"
200
-
201
- *data*: the data response structure. In case of json we can get it as a hash by using: `resp.data.json`. Also you can filter the json structure and get what you want: `resp.data.json(:loginname, :address)`
202
-
203
- Also interesting keys would be: *time_elapsed_total*, *time_elapsed* and many more available
204
-
205
-
206
- ## Special settings
207
-
208
- *debug*: (true or false) it will set the connecition on debug mode so you will be able to see the whole communication with the server in detail
209
-
210
- *log*: (:no, :screen, :file, :fix_file, "filename") it will log the basic communication for inspect. In case you want to add extra info to your logs you can do it for example adding to your code: http.logger.info "example extra log"
211
-
212
- *headers*: Hash containing the headers for the communication
213
-
214
- *cookies*: Hash containing the cookies for the communication
215
-
216
- *proxy_port, proxy_host*: in case you want to use a proxy for the connection
217
-
218
- *use_mocks*: (true or false) in case of true if the request hash contains a mock_response key it will be returning that response instead of trying to send the request.
219
-
220
- *auto_redirect*: (true or false) in case of true it will take care of the auto redirections.
221
-
222
- ## Authentication requests
223
-
224
- All we need to do is to add to our request the correct authentication tokens, seeds, headers.
225
-
226
- For example for Basic Authentication we need to add to the authorization header a seed generated with the user and password we want ot authenticate
227
-
228
- ```ruby
229
-
230
- @http = NiceHttp.new("https://jigsaw.w3.org/")
231
-
232
- @http.headers.authorization = NiceHttpUtils.basic_authentication(user: "guest", password: "guest")
233
-
234
- # headers will be in this example: {:authorization=>"Basic Z3Vlc3Q6Z3Vlc3Q=\n"}
235
-
236
- resp = @http.get("/HTTP/Basic/")
237
-
238
- ```
239
-
240
- Remember for other kind of authentication systems NiceHttp take care of the redirections and cookies that are requested to be set. In case you need to add a header with a token you can add it by using your NiceHttp object and the key headers, for example:
241
-
242
- ```ruby
243
- @http.headers.tokenuno = "xxx"
244
- # headers => {tokenuno: "xxx"}
245
-
246
- #another way:
247
- @http.headers[:tokendos] = "yyy"
248
- # headers => {tokenuno: "xxx", tokendos: "yyyy"}
249
-
250
- ```
251
-
252
- In case you want or need to control the redirections by yourself instead of allowing NiceHttp to do it, then set ```@http.auto_redirect = false```
253
-
254
- An example using OpenID authentication:
255
-
256
- ```ruby
257
- server = "https://samples.auth0.com/"
258
- path="/authorize?client_id=kbyuFDidLLm280LIwVFiazOqjO3ty8KH&response_type=code"
259
-
260
- @http = NiceHttp.new(server)
261
-
262
- resp = @http.get(path)
263
-
264
- p "With autoredirection:"
265
- p "Cookies: "
266
- p @http.cookies
267
- p "Code: #{resp.code} #{resp.message} "
268
- p "*"*40
269
-
270
- @http2 = NiceHttp.new(server)
271
- @http2.auto_redirect = false
272
-
273
- resp = @http2.get(path)
274
-
275
- p "Without autoredirection:"
276
- p "Cookies: "
277
- p @http2.cookies
278
- p "Code: #{resp.code} #{resp.message} "
279
-
280
- ```
281
-
282
- The output:
283
-
284
- ```
285
- "With autoredirection:"
286
- "Cookies: "
287
- {"/"=>{"auth0"=>"s%3A6vEEwmmIf-9YAG-NjvsOIyZAh-NS97jj.yFSXILdmCov6DRwXjEei3q3eHIrxZxHI4eg4%2BTpUaK4"},
288
- "/usernamepassword/login"=>{"_csrf"=>"bboZ0koMScwXkISzWaAMTYdY"}}
289
- "Code: 200 OK "
290
- "****************************************"
291
- "Without autoredirection:"
292
- "Cookies: "
293
- {"/"=>{"auth0"=>"s%3AcKndc44gllWyJv8FLztUIctuH4b__g0V.QEF3SOobK8%2FvX89iUKzGbfSP4Vt2bRtY2WH7ygBUkg4"}}
294
- "Code: 302 Found "
295
-
296
- ```
297
-
298
-
299
- ## Send multipart content
300
-
301
- Example posting a csv file:
302
-
303
- ```ruby
304
-
305
- require 'net/http/post/multipart'
306
- request = {
307
- path: "/customer/profile/",
308
- headers: {'Content-Type' => 'multipart/form-data'},
309
- data: (Net::HTTP::Post::Multipart.new "/customer/profile/",
310
- "file" => UploadIO.new("./path/to/my/file.csv", "text/csv"))
311
- }
312
- response=@http.post(request)
313
-
314
- ```
315
-
316
- ## Contributing
317
-
318
- Bug reports and pull requests are welcome on GitHub at https://github.com/marioruiz/nice_http.
319
-
320
-
321
- ## License
322
-
323
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
324
-
325
-
1
+ # NiceHttp
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/nice_http.svg)](https://rubygems.org/gems/nice_http)
4
+ [![Build Status](https://travis-ci.com/MarioRuiz/nice_http.svg?branch=master)](https://github.com/MarioRuiz/nice_http)
5
+ [![Coverage Status](https://coveralls.io/repos/github/MarioRuiz/nice_http/badge.svg?branch=master)](https://coveralls.io/github/MarioRuiz/nice_http?branch=master)
6
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FMarioRuiz%2Fnice_http.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FMarioRuiz%2Fnice_http?ref=badge_shield)
7
+
8
+ NiceHttp the simplest library for accessing and testing HTTP and REST resources.
9
+
10
+ Manage different hosts on the fly. Easily get the value you want from the JSON strings. Use hashes on your requests.
11
+
12
+ Also you can use mock responses by using :mock_response key on the request hash and enable the use_mocks option on NiceHttp.
13
+
14
+ NiceHttp will take care of the redirections and the cookies, and for security tests you will be able to modify the cookies or disable and control the redirections by yourself.
15
+
16
+ To be able to generate random requests take a look at the documentation for nice_hash gem: https://github.com/MarioRuiz/nice_hash
17
+
18
+ Example that creates 1000 good random and unique requests to register an user and test that the validation of the fields are correct by the user was able to be registered. Send 800 requests where just one field is wrong and verify the user was not able to be created: https://gist.github.com/MarioRuiz/824d7a462b62fd85f02c1a09455deefb
19
+
20
+ ## Installation
21
+
22
+ Install it yourself as:
23
+
24
+ $ gem install nice_http
25
+
26
+
27
+ ## A very simple first example
28
+
29
+ ```ruby
30
+ require 'nice_http'
31
+
32
+ http = NiceHttp.new('https://reqres.in')
33
+
34
+ resp = http.get("/api/users?page=2")
35
+
36
+ pp resp.code
37
+ pp resp.data.json
38
+
39
+ resp = http.get("/api/users/2")
40
+
41
+ pp resp.data.json(:first_name, :last_name)
42
+
43
+ resp = http.post( {
44
+ path: "/api/users",
45
+ data: { name: "morpheus", job: "leader" }
46
+ } )
47
+
48
+ pp resp.data.json
49
+ ```
50
+
51
+ ## Create a connection
52
+
53
+ The simplest way is just by supplying the value as an argument:
54
+
55
+ ```ruby
56
+
57
+ # as an url
58
+ http1 = NiceHttp.new("https://example.com")
59
+
60
+ # as parameters
61
+ http2 = NiceHttp.new( host: "reqres.in", port: 443, ssl: true )
62
+
63
+ # as a hash
64
+ http3 = NiceHttp.new my_reqres_server
65
+
66
+
67
+ ```
68
+
69
+
70
+ You can specify all the defaults you will be using when creating connections by using the NiceHttp methods, in this example, http1 and http2 will be connecting to reqres.in with the default parameters and http3 to example.com:
71
+
72
+ ```ruby
73
+
74
+ # default parameters
75
+ NiceHttp.host = 'reqres.in'
76
+ NiceHttp.ssl = true
77
+ NiceHttp.port = 443
78
+ NiceHttp.debug = false
79
+ NiceHttp.log = "./my_logs.log"
80
+ NiceHttp.headers = {"api-key": "the api key"}
81
+
82
+ http1 = NiceHttp.new()
83
+
84
+ http2 = NiceHttp.new()
85
+
86
+ http3 = NiceHttp.new("https://example.com")
87
+
88
+ ```
89
+
90
+ If you prefer to supply a hash to change the default settings for NiceHttp:
91
+
92
+ ```ruby
93
+ NiceHttp.defaults = {
94
+ host: 'reqres.in',
95
+ ssl: true,
96
+ port: 443,
97
+ debug: false,
98
+ log: "./my_logs.log",
99
+ headers: {"api-key": "the api key"}
100
+ }
101
+ ```
102
+
103
+
104
+ ## Creating requests
105
+
106
+ You can use hash requests to simplify the management of your requests, for example creating a file specifying all the requests for your Customers API.
107
+
108
+ The keys you can use:
109
+
110
+ *path*: relative or absolute path, for example: "/api2/customers/update.do"
111
+
112
+ *headers*: specific headers for the request. It will include a hash with the values.
113
+
114
+ *data*: the data to be sent for example a JSON string. In case of supplying a Hash, Nice Http will assume that is a JSON and will convert it to a JSON string before sending the request and will add to the headers: 'Content-Type': 'application/json'
115
+
116
+ *mock_response*: In case of use_mocks=true then NiceHttp will return this response
117
+
118
+
119
+ Let's guess you have a file with this data for your requests on */requests/example.rb*:
120
+
121
+ ```ruby
122
+
123
+ module Requests
124
+
125
+ module Example
126
+
127
+ # simple get request example
128
+ def self.list_of_users()
129
+ {
130
+ path: "/api/users?page=2"
131
+ }
132
+ end
133
+
134
+ # post request example using a request hash that will be converted automatically to a json string
135
+ def self.create_user_hash()
136
+ {
137
+ path: "/api/users",
138
+ data: {
139
+ name: "morpheus",
140
+ job: "leader"
141
+ }
142
+ }
143
+ end
144
+
145
+ # post request example using a JSON string
146
+ def self.create_user_raw()
147
+ {
148
+ path: "/api/users",
149
+ headers: {"Content-Type": "application/json"},
150
+ data: '{"name": "morpheus","job": "leader"}'
151
+ }
152
+ end
153
+
154
+ end
155
+
156
+ end
157
+
158
+ ```
159
+
160
+
161
+ Then in your code you can require this request file and use it like this:
162
+
163
+ ```ruby
164
+
165
+ resp = http.get Requests::Example.list_of_users
166
+
167
+ pp resp.code
168
+
169
+ resp = http.post Requests::Example.create_user_hash
170
+
171
+ pp resp.data.json
172
+
173
+
174
+ resp = http.post Requests::Example.create_user_raw
175
+
176
+ pp resp.data.json(:job)
177
+
178
+
179
+ ```
180
+
181
+
182
+ In case you want to modify the request before sending it, for example just changing one field but the rest will be the same, you can supply a new key :values_for in the request hash that will contain a hash with the keys to be changed and NiceHttp will perform the necessary changes at any level:
183
+
184
+ ```ruby
185
+
186
+ req = Requests::Example.create_user_hash
187
+ req.values_for = {job: "developer"}
188
+
189
+ resp = http.post req
190
+
191
+ pp resp.data.json
192
+ #response: {:name=>"morpheus", :job=>"developer", :id=>"192", :createdAt=>"2018-12-14T14:41:54.371Z"}
193
+
194
+ ```
195
+
196
+ ## Responses
197
+
198
+ The response will include at least the keys:
199
+
200
+ *code*: the http code response, for example: 200
201
+
202
+ *message*: the http message response, for example: "OK"
203
+
204
+ *data*: the data response structure. In case of json we can get it as a hash by using: `resp.data.json`. Also you can filter the json structure and get what you want: `resp.data.json(:loginname, :address)`
205
+
206
+ Also interesting keys would be: *time_elapsed_total*, *time_elapsed* and many more available
207
+
208
+
209
+ ## Special settings
210
+
211
+ *debug*: (true or false) it will set the connecition on debug mode so you will be able to see the whole communication with the server in detail
212
+
213
+ *log*: (:no, :screen, :file, :fix_file, "filename") it will log the basic communication for inspect. In case you want to add extra info to your logs you can do it for example adding to your code: http.logger.info "example extra log"
214
+
215
+ *headers*: Hash containing the headers for the communication
216
+
217
+ *cookies*: Hash containing the cookies for the communication
218
+
219
+ *proxy_port, proxy_host*: in case you want to use a proxy for the connection
220
+
221
+ *use_mocks*: (true or false) in case of true if the request hash contains a mock_response key it will be returning that response instead of trying to send the request.
222
+
223
+ *auto_redirect*: (true or false) in case of true it will take care of the auto redirections.
224
+
225
+ ## Authentication requests
226
+
227
+ All we need to do is to add to our request the correct authentication tokens, seeds, headers.
228
+
229
+ For example for Basic Authentication we need to add to the authorization header a seed generated with the user and password we want ot authenticate
230
+
231
+ ```ruby
232
+
233
+ @http = NiceHttp.new("https://jigsaw.w3.org/")
234
+
235
+ @http.headers.authorization = NiceHttpUtils.basic_authentication(user: "guest", password: "guest")
236
+
237
+ # headers will be in this example: {:authorization=>"Basic Z3Vlc3Q6Z3Vlc3Q=\n"}
238
+
239
+ resp = @http.get("/HTTP/Basic/")
240
+
241
+ ```
242
+
243
+ Remember for other kind of authentication systems NiceHttp take care of the redirections and cookies that are requested to be set. In case you need to add a header with a token you can add it by using your NiceHttp object and the key headers, for example:
244
+
245
+ ```ruby
246
+ @http.headers.tokenuno = "xxx"
247
+ # headers => {tokenuno: "xxx"}
248
+
249
+ #another way:
250
+ @http.headers[:tokendos] = "yyy"
251
+ # headers => {tokenuno: "xxx", tokendos: "yyyy"}
252
+
253
+ ```
254
+
255
+ In case you want or need to control the redirections by yourself instead of allowing NiceHttp to do it, then set ```@http.auto_redirect = false```
256
+
257
+ An example using OpenID authentication:
258
+
259
+ ```ruby
260
+ server = "https://samples.auth0.com/"
261
+ path="/authorize?client_id=kbyuFDidLLm280LIwVFiazOqjO3ty8KH&response_type=code"
262
+
263
+ @http = NiceHttp.new(server)
264
+
265
+ resp = @http.get(path)
266
+
267
+ p "With autoredirection:"
268
+ p "Cookies: "
269
+ p @http.cookies
270
+ p "Code: #{resp.code} #{resp.message} "
271
+ p "*"*40
272
+
273
+ @http2 = NiceHttp.new(server)
274
+ @http2.auto_redirect = false
275
+
276
+ resp = @http2.get(path)
277
+
278
+ p "Without autoredirection:"
279
+ p "Cookies: "
280
+ p @http2.cookies
281
+ p "Code: #{resp.code} #{resp.message} "
282
+
283
+ ```
284
+
285
+ The output:
286
+
287
+ ```
288
+ "With autoredirection:"
289
+ "Cookies: "
290
+ {"/"=>{"auth0"=>"s%3A6vEEwmmIf-9YAG-NjvsOIyZAh-NS97jj.yFSXILdmCov6DRwXjEei3q3eHIrxZxHI4eg4%2BTpUaK4"},
291
+ "/usernamepassword/login"=>{"_csrf"=>"bboZ0koMScwXkISzWaAMTYdY"}}
292
+ "Code: 200 OK "
293
+ "****************************************"
294
+ "Without autoredirection:"
295
+ "Cookies: "
296
+ {"/"=>{"auth0"=>"s%3AcKndc44gllWyJv8FLztUIctuH4b__g0V.QEF3SOobK8%2FvX89iUKzGbfSP4Vt2bRtY2WH7ygBUkg4"}}
297
+ "Code: 302 Found "
298
+
299
+ ```
300
+
301
+
302
+ ## Send multipart content
303
+
304
+ Example posting a csv file:
305
+
306
+ ```ruby
307
+
308
+ require 'net/http/post/multipart'
309
+ request = {
310
+ path: "/customer/profile/",
311
+ headers: {'Content-Type' => 'multipart/form-data'},
312
+ data: (Net::HTTP::Post::Multipart.new "/customer/profile/",
313
+ "file" => UploadIO.new("./path/to/my/file.csv", "text/csv"))
314
+ }
315
+ response=@http.post(request)
316
+
317
+ ```
318
+
319
+ ## Contributing
320
+
321
+ Bug reports and pull requests are welcome on GitHub at https://github.com/marioruiz/nice_http.
322
+
323
+
324
+ ## License
325
+
326
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
327
+
328
+
329
+
330
+
331
+ [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FMarioRuiz%2Fnice_http.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FMarioRuiz%2Fnice_http?ref=badge_large)