can-connect icon indicating copy to clipboard operation
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.

Open abdulsmrehman opened this issue 8 years ago • 2 comments

  • [ 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

abdulsmrehman avatar Sep 18 '17 07:09 abdulsmrehman

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

chasenlehara avatar Sep 18 '17 15:09 chasenlehara

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

ivospinheiro avatar Sep 18 '17 15:09 ivospinheiro