spec/aitch/request_spec.rb in aitch-0.4.0 vs spec/aitch/request_spec.rb in aitch-0.4.1
- old
+ new
@@ -73,9 +73,19 @@
).request
expect(request.body).to eql({a: 1}.to_json)
end
+ it "sets json body from object (default headers)" do
+ request = build_request(
+ request_method: "post",
+ data: {a: 1},
+ options: {json_parser: JSON, default_headers: {'Content-Type' => 'application/json'}}
+ ).request
+
+ expect(request.body).to eql({a: 1}.to_json)
+ end
+
it "sets request body from to_h protocol" do
data = double(to_h: {a: 1})
request = build_request(request_method: "post", data: data).request
expect(request.body).to eql("a=1")
end