Socket
Socket
Sign inDemoInstall

w3c-xmlhttprequest

Package Overview
Dependencies
0
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    w3c-xmlhttprequest

Server-side XMLHttpRequest.


Version published
Maintainers
1
Install size
439 kB
Created

Changelog

Source

3.0.4 (2021-12-16)

Bug Fixes

  • release-please: support require under Node (#472) (a22663b)

Readme

Source

w3c-xmlhttprequest Node.js CI

Server-side XMLHttpRequest like Living Standard for Node.

Install

$ npm install w3c-xmlhttprequest

or

$ yarn add w3c-xmlhttprequest

Example

Simple GET request

import { XMLHttpRequest } from 'w3c-xmlhttprequest';

const client = new XMLHttpRequest();
client.open('GET', 'https://example.com/');
client.addEventListener('load', () => {
  console.log('Received an HTTP response.');
}
client.send();

Parse JSON response

import { XMLHttpRequest } from 'w3c-xmlhttprequest';

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

LICENSE

MIT License

Keywords

FAQs

Last updated on 16 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc