Setting Content-Type on POST ($xhr/$resource)

309 views
Skip to first unread message

Mårten

unread,
Dec 6, 2010, 11:22:45 AM12/6/10
to Angular
Hi!

Quick question: Is it possible to set the HTTP Content-Type request
header on POST using $resource or $xhr? We would like to set it to
'application/json', it seems like it is hard-coded to 'application/x-
www-form-urlencoded'?

We can work around this by accepting '*/*' on the server, but that
doesn't feel like the proper solution...

Thanks!

/mårten



Igor Minar

unread,
Dec 6, 2010, 12:27:07 PM12/6/10
to ang...@googlegroups.com
Hi!

You are right. The content type is currently hardcoded
(Browser.js:L55). This is lame and must be corrected.

We are working on a much better resource and xhr implementation, but
it will be ready only at the end of this month or so. In the meantime,
I suggest that you just patch that one line of code.

thanks,
Igor

> --
> You received this message because you are subscribed to the Google Groups "Angular" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to angular+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/angular?hl=en.
>
>

Igor Minar

unread,
Dec 6, 2010, 12:30:41 PM12/6/10
to ang...@googlegroups.com

Mårten Dolk

unread,
Dec 6, 2010, 1:09:21 PM12/6/10
to ang...@googlegroups.com
Fair enough :-)

Thanks for the quick response,
/Mårten

2010/12/6 Igor Minar <iim...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages