Content in response can not be resolved to acceptable content type


#1

Hi,
I have sucessfully connected to the sql server database in the services section. However when I click the APIDocs, I get the following error

BadRequestException in ResponseFactory.php line 158:

Content in response can not be resolved to acceptable content type.

1. in ResponseFactory.php line 158
2.at ResponseFactory::sendResponse(object(ServiceResponse), array('text/html', ' application/xhtml+xml', ' */*')) in ResponseFactory.php line 255
3.at ResponseFactory::getException(object(BadRequestException), object(Request)) in compiled.php line 17859
4.at AccessCheck->handle(object(Request), object(Closure))
5.at call_user_func_array(array(object(AccessCheck), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
6.at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
7.at call_user_func(object(Closure), object(Request)) in compiled.php line 9535
8.at Pipeline->then(object(Closure)) in compiled.php line 8892
9.at ControllerDispatcher->callWithinStack(object(RestController), object(Route), object(Request), 'handleGET') in compiled.php line 8877
10.at ControllerDispatcher->dispatch(object(Route), object(Request), 'DreamFactory\Http\Controllers\RestController', 'handleGET') in compiled.php line 7831
11.at Route->runWithCustomDispatcher(object(Request)) in compiled.php line 7802
12.at Route->run(object(Request)) in compiled.php line 7455
13.at Router->Illuminate\Routing\{closure}(object(Request))
14.at call_user_func(object(Closure), object(Request)) in compiled.php line 9553
15.at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
16.at call_user_func(object(Closure), object(Request)) in compiled.php line 9535
17.at Pipeline->then(object(Closure)) in compiled.php line 7456
18.at Router->runRouteWithinStack(object(Route), object(Request)) in compiled.php line 7444
19.at Router->dispatchToRoute(object(Request)) in compiled.php line 7429
20.at Router->dispatch(object(Request)) in compiled.php line 2304
21.at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
22.at call_user_func(object(Closure), object(Request)) in compiled.php line 9553
23.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in HandleCors.php line 43
24.at HandleCors->handle(object(Request), object(Closure))
25.at call_user_func_array(array(object(Cors), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
26.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 17932
27.at FirstUserCheck->handle(object(Request), object(Closure))
28.at call_user_func_array(array(object(FirstUserCheck), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
29.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12881
30.at ShareErrorsFromSession->handle(object(Request), object(Closure))
31.at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
32.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 11504
33.at StartSession->handle(object(Request), object(Closure))
34.at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
35.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12622
36.at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
37.at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
38.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 12561
39.at EncryptCookies->handle(object(Request), object(Closure))
40.at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
41.at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in compiled.php line 2978
42.at CheckForMaintenanceMode->handle(object(Request), object(Closure))
43.at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9545
44.at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
45.at call_user_func(object(Closure), object(Request)) in compiled.php line 9535
46.at Pipeline->then(object(Closure)) in compiled.php line 2251
47.at Kernel->sendRequestThroughRouter(object(Request)) in compiled.php line 2234
48.at Kernel->handle(object(Request)) in index.php line 53

Can you please help me out with this ?

Thanks and Regards
Gagan


#2

I believe this is indicative of a bug that was fixed in the 2.0.2 release – pushed to Github last night. Bitnami packages forthcoming.


#3

Hi,

I am having this same issue. I installed df2 via its git repository and I just updated to the latest version (2.0.4) today to make sure it was not related to the same 2.0.2 bug documented previously.

Below I include the response I get from the df server using the Chrome console:

General
Request URL:https://contibands-api.cloud1.mx/api/v2/user/session
Request Method:POST
Status Code:400 Bad Request
Remote Address:159.203.214.101:443

Response Headers
view source
Access-Control-Allow-Origin:http://localhost:4200
Cache-Control:no-cache
Connection:keep-alive
Content-Type:application/json
Date:Wed, 13 Jan 2016 20:19:10 GMT
Server:nginx/1.4.6 (Ubuntu)
Transfer-Encoding:chunked
Vary:Origin
X-Powered-By:PHP/5.5.9-1ubuntu4.14

Request Headers
view source
Accept:application/json, text/javascript
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8,es;q=0.6
Connection:keep-alive
Content-Length:53
Content-Type:application/json
Host:contibands-api.cloud1.mx
Origin:http://localhost:4200
Referer:http://localhost:4200/login
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36

Request Payload
{password: "abcd1234", email: "testowner@cloud1.mx"}

The issue is only happening when calling the API from my Ember app prototype. However, if I test with Postman it works OK, I get the session token and the user info as expected.

I tried to check the logs in storage/logs/dreamfactory.log but it only outputs:
[2016-01-13 20:19:10] development.DEBUG: Resource event: user.session.post.pre_process
[2016-01-13 20:19:10] development.DEBUG: Resource event: user.session.post.post_process

Do you have an idea on what’s wrong?

Thank you in advance,
Daniel


#4

your accept header is asking for javascript

DreamFactory will only process json or xml


#5

Thank you. You were right!

Daniel