cucumber-api icon indicating copy to clipboard operation
cucumber-api copied to clipboard

POST with json file

Open gokcesurenkok opened this issue 7 years ago • 2 comments

Hi, When I send a POST request with a json file in a given path, json file is parsed as hash, that causes problem at RestClient side.

You need to modify @body with @body.to_json , otherwise it returns 415 as response code

when 'json' @body = JSON.parse File.read(path) **@body = @body.to_json** else

gokcesurenkok avatar Jan 24 '17 06:01 gokcesurenkok

Hi wanna send a PR? I'll merge soon as I can :)

hidroh avatar Jan 24 '17 07:01 hidroh

Also encountering this same issue. You can also fix it by:

@body = JSON.dump(JSON.parse File.read(path))

kevgatch avatar Sep 11 '17 04:09 kevgatch