cujojs / rest

RESTful HTTP client for JavaScript
http://cujojs.com/
Other
1k stars 146 forks source link

mime-serialization error with custom mime converter #177

Closed ArbanNichols closed 5 years ago

ArbanNichols commented 7 years ago

I created am using a custom mime converter for the "text/uri-list" content negotiation with a 'PUT' request and the web browser is giving a "mime-serialization" error. The 'PUT' request succeeds using curl.

Doogiemuc commented 6 years ago

This is my text/uri list converter that works for me, also for PUT requests. Hope that helps

/**
 * MIME type interceptor for our REST client that can handle 
 * Content-type: "text/uri"
 */
import registry from 'rest/mime/registry'

var uriListConverter = {
    read: function (str, opts) {
      return str;  //MAYBE convert to a array
    },
    write: function (obj, opts) {
      return obj.toString();
    }
}

registry.register('text/uri-list', uriListConverter);
scothis commented 5 years ago

rest.js is no longer maintained