can-connect
can-connect copied to clipboard
Canjs [can-connect/data/url] supports only "application/json" and "application/x-www-form-urlencoded". Other vendor sepcific contenType are not supported.
- [ 1] Always
Description : I want pass a vendor specific Media type on the request header , But can-connect/data/url supports only 2 media type "application/json" and "application/x-www-form-urlencoded" others are marked unsupported and the default content type["application/json"] is used, when any unsupported type is passed .
var connection = persist({ url: { createData: "POST /api/restaurants", contentType: "application/vnd.vendorspecific-v1+json" } });
Is there a way that i can override findContentType of url.js which actually does this validation and returns default "application/json" type. Please provide your suggestion on how to tackle this,
| Software | Version |
|---|---|
| can-connect version | 1.4.1 |
| Browser | chrome |
| Operating system | Windows |
For reference, here’s where this question was asked and @jeroencornelissen & @ivospinheiro helpfully provided a workaround: https://gitter.im/canjs/canjs?at=59bfa1b5cfeed2eb652288b1
Can this configuration be added to the can-connect url behavior?