# Curl works when testing JSON response but the functional and integration tests do not work

**URL:** <https://www.ruby-forum.com/t/curl-works-when-testing-json-response-but-the-functional-and-integration-tests-do-not-work/192614>\
**Category:** Rails\
**Created:** [August 3, 2010, 6:35am UTC](https://www.ruby-forum.com/t/curl-works-when-testing-json-response-but-the-functional-and-integration-tests-do-not-work/192614 "2010-08-03T06:35:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_U](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/90db22/32.png) [@Tim\_U](https://www.ruby-forum.com/u/Tim_U)\
**Post date:** [August 3, 2010, 6:35am UTC](https://www.ruby-forum.com/t/curl-works-when-testing-json-response-but-the-functional-and-integration-tests-do-not-work/192614/1 "2010-08-03T06:35:19Z")

</div>

I am trying to test an action which is supposed to give a json  
response The url goes something line /blah/model.json

When I POST to that URL using curl like this

curl -H “Content-Type:application/json” -H “Accept:appn/json” -d  
“data” [http://localhost:3000/blah/model.json](http://localhost:3000/blah/model.json) it works just fine.

In my test functional test I have this method

def post\_json (data)  
post “/blah/model.json”, {:data =\> data.to\_json}, {‘Content-Type’  
=\> ‘application/json’, ‘Accept’ =\> ‘application/json’}  
end

When I run this test I get the error

ActionController::UnknownAction: No action responded to  
/blah/model.json. Actions: index

The route is defined like this.

map.connect ‘/blah/:model.:format’, :controller =\> ‘xfer’, :action =\>  
‘index’ , :conditions =\> { :method =\> :post }
