-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept request header for json #161
Comments
could you give me an example of how you're making the http request? If you pass in an object for the body then Marty should automatically add the |
This is how I do it: CollectionsAPI = Marty.createStateSource
type: 'http'
findAll: ->
@get(Routes.collections_path()).then (res)->
CollectionsSourceActionCreators.receiveItems res.body |
ah, I see. yeah CollectionsAPI = Marty.createStateSource
type: 'http'
findAll: ->
request =
url: Routes.collections_path()
headers: { 'content-type': 'application/json' }
@get(request).then (res)->
CollectionsSourceActionCreators.receiveItems res.body |
Awesome! thank you very much! |
dataType is now in the v0.9 branch (#176). Hopefully this will be out soon Also I realised my previous example was wrong. It should be CollectionsAPI = Marty.createStateSource
type: 'http'
findAll: ->
request =
url: Routes.collections_path()
headers: { 'Accept': 'application/json' }
@get(request).then (res)->
CollectionsSourceActionCreators.receiveItems res.body |
With the |
Hi!
I'm using Marty in a Rails application and I have noticed that all requests done by my HttpStores are done as *"* / " instead of being "application/json" which is the format that I need. To do so using jquery for example I can set the dataType: 'json' attribute and I was wondering if something similar could be done in Marty.
This is what request format looks like using jquery ajax:
And this is using Marty's HttpStore:
Thanks in advance and thanks also for the awesome work you're doing here :)
The text was updated successfully, but these errors were encountered: