HTTP Module
Last updated
Was this helpful?
Was this helpful?
import http from 'http'
import xml from 'xml'
import request from 'request'
import response from 'response'
let data = http.get('http://www.xmlfiles.com/examples/simple.xml', {headers: {accept: 'text/xml'}}).body
if (request.getHeader('Accept') == 'text/xml') {
response.setHeader('Content-Type', 'text/xml')
response.write(data)
return
}
return xml.toJs(data)