w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Rails test is converting my array of ints to an array of strings

You need to specify that the request not only accepts JSON (-H "Accept: application/json" in curl, request.env["HTTP_ACCEPT"] = 'application/json' in the test), but sends data as JSON (-H "Content-type: application/json" in curl, nothing in the test).

Try something like

post :create, params.to_json, format: :json

or

post :create, params.to_json, {'CONTENT_TYPE' =>
'application/json'}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.