javascript - Ember-data nested-url adapter doesnt show request payload in request headers -


ember-data doesn't support nested api urls in models. need write our own custom adapter. have added nested_url_adapter . issues having right now::

  1. when doing post request api "http://api.server/resource/resourceid/childresource", request payload on request headers not present.

2̶.̶ ̶i̶ ̶a̶m̶ ̶u̶s̶i̶n̶g̶ ̶e̶m̶b̶e̶r̶-̶s̶i̶m̶p̶l̶e̶-̶a̶u̶t̶h̶ ̶l̶i̶b̶ ̶f̶o̶r̶ ̶t̶h̶e̶ ̶a̶u̶t̶h̶e̶n̶t̶i̶c̶a̶t̶i̶o̶n̶ ̶a̶n̶d̶ ̶a̶u̶t̶h̶o̶r̶i̶z̶a̶t̶i̶o̶n̶,̶ ̶w̶h̶i̶l̶e̶ ̶d̶o̶i̶n̶g̶ ̶t̶h̶e̶ ̶p̶o̶s̶t̶ ̶r̶e̶q̶u̶e̶s̶t̶,̶ ̶i̶n̶ ̶t̶h̶e̶ ̶r̶e̶q̶u̶e̶s̶t̶ ̶h̶e̶a̶d̶e̶r̶ ̶t̶h̶e̶r̶e̶ ̶i̶s̶ ̶n̶o̶ ̶a̶u̶t̶h̶o̶r̶i̶z̶a̶t̶i̶o̶n̶ ̶h̶e̶a̶d̶e̶r̶.̶

i have implemented same nested_url adapter little modification type.typekey per api server.

here gist of files have in application: gist

xhr request tabs::

remote address: 127.0.1.1: 80 request url: http: //api.server/events/9/tickets request method: options status code: 200 ok request headersview parsed options / events / 9 / tickets http / 1.1 host: api.server connection: keep - alive access - control - request - method: post origin: http: //0.0.0.0:4300 user - agent: mozilla / 5.0(x11; linux x86_64) applewebkit / 537.36(khtml, gecko) chrome / 36.0.1941.0 safari / 537.36 access - control - request - headers: accept, client_id accept: * /* referer: http://0.0.0.0:4300/event/9/manage/tickets accept-encoding: gzip,deflate,sdch accept-language: en-us,en;q=0.8 response headersview parsed http/1.1 200 ok date: thu, 24 apr 2014 11:51:07 gmt server: apache/2.4.9 (ubuntu) x-powered-by: php/5.5.11-2+deb.sury.org~precise+2 access-control-allow-origin: * access-control-allow-methods: get, post, put, delete, options access-control-allow-headers: authorization, content-type, client_id, client_secret access-control-max-age: 0 content-length: 0 keep-alive: timeout=5, max=100 connection: keep-alive content-type: text/html*/ 

post request ::

remote address: 127.0.1.1: 80 request url: http: //api.server/events/9/tickets request method: post status code: 201 created request headersview source accept: application / json, text / javascript, * /*; q=0.01 accept-encoding:gzip,deflate,sdch accept-language:en-us,en;q=0.8 client_id:[object object] connection:keep-alive content-length:0 host:api.server origin:http://0.0.0.0:4300 referer:http://0.0.0.0:4300/event/9/manage/tickets user-agent:mozilla/5.0 (x11; linux x86_64) applewebkit/537.36 (khtml, gecko) chrome/36.0.1941.0 safari/537.36 response headersview source access-control-allow-origin:* access-control-expose-headers: connection:keep-alive content-length:242 content-type:application/hal+json date:thu, 24 apr 2014 11:51:07 gmt keep-alive:timeout=5, max=99 location:http://api.server/events/9/tickets/24 server:apache/2.4.9 (ubuntu) x-powered-by:php/5.5.11-2+deb.sury.org~precise+2*/ 

as per marcoow's comment 2nd issue has been solved. still 1st issue there.

when you're using ember.simpleauth cross-origin requests have explicitly whitelist these origins have authorization header added ember.simpleauth (that's security feature make sure token doesn't published across internet) - see here: http://ember-simple-auth.simplabs.com/ember-simple-auth-api-docs.html#ember-simpleauth-setup


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -