[solved] HTTP package - Request header field is not allowed

url = 'http://api.atompark.com/members/sms/xml.php'
xml = 'some xml'

When I use jquery, everything’s honky dory:

$.ajax({
  method: 'POST',
  url: url,
  data: xml
}).done(function(r) {
  return log(r);
});

But when I use HTTP package, I get an error:

HTTP.post(url, {
  data: xml
}, function(e, r) {
  return log(r.content);
});

XMLHttpRequest cannot load http://api.atompark.com/members/sms/xml.php. Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.

What could be wrong?

The docs state (and examples show) that data must be a JSON-able object (so an XML string wouldn’t qualify). Maybe the content option would work?

1 Like

Ah, yes, that nailed it!
I hug you, my friend!

1 Like