server-side XMLHttpRequest for Node.
JavaScript
Latest commit 3ba6520 Nov 13, 2016 @ykzts 2.1.2
Permalink
Failed to load latest commit information.
lib Fix #40 Nov 13, 2016
test Add ESLint Jan 17, 2016
.eslintrc.json Add ESLint Jan 17, 2016
.gitignore first commit Jun 14, 2012
.travis.yml run lint in ci Jan 18, 2016
LICENSE es2015 Jan 17, 2016
README.md Change to latest the W3C spec URI [ci skip] Jan 28, 2016
package.json 2.1.2 Nov 13, 2016

README.md

w3c-xmlhttprequest Build Status

Server-side XMLHttpRequest like W3C spec for Node.

This library is still in development. We are recruiting contributors and your pull requests.

Install

$ npm install w3c-xmlhttprequest

Example

Simple GET request

var XMLHttpRequest = require('w3c-xmlhttprequest').XMLHttpRequest;

var client = new XMLHttpRequest();
client.open('GET', 'http://example.com/');
client.addEventListener('load', function(event) {
  console.log('HTTP Request OSHIMAI.');
}, false);
client.send();

Parse JSON response

var XMLHttpRequest = require('w3c-xmlhttprequest').XMLHttpRequest;

var client = new XMLHttpRequest();
client.open('GET', 'http://exmaple.com/data.json');
client.responseType = 'json';
client.addEventListener('load', function() {
  var data = client.response;
  if (data.meta.status !== 200) {
    return;
  }
  console.log(data.response.blog.title);
}, false);
client.send();

LICENSE

MIT License