canjs / can-connect

Model layer utilities for every JavaScript framework! Assemble real-time, high performance, restful data connections.
https://canjs.com/doc/can-connect.html
MIT License
29 stars 16 forks source link

Canjs [can-connect/data/url] supports only "application/json" and "application/x-www-form-urlencoded". Other vendor sepcific contenType are not supported. #351

Open abdulsmrehman opened 6 years ago

abdulsmrehman commented 6 years ago

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
chasenlehara commented 6 years ago

For reference, here’s where this question was asked and @jeroencornelissen & @ivospinheiro helpfully provided a workaround: https://gitter.im/canjs/canjs?at=59bfa1b5cfeed2eb652288b1

ivospinheiro commented 6 years ago

Can this configuration be added to the can-connect url behavior?