ladjs/frisbee

XML response support

gcolton opened this issue · 2 comments

Looking briefly through the docs, I wasn't able to find support for XML responses from a server (e.g. response of type Document to allow for XML dom parsing). Did I miss something? Any advice on a set up to deal with both XML and JSON responses from a server?

you can change the headers to something like:

const xmlApi = new Frisbee({
  baseURI: 'https://api.startup.com',
  headers: {
    'Accept': 'application/xml',
    'Content-Type': 'application/xml'
  }
});

and then use a parser like https://www.npmjs.com/package/fast-xml-parser or https://github.com/Leonidas-from-XIV/node-xml2js

if this doesn't work lmk and can reopen