server-side XMLHttpRequest for Node.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.eslintrc.json
.gitignore
.travis.yml
LICENSE
README.md
package.json

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