New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

requestadapter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

requestadapter

A convenience wrapper for javascript request/response objects

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

RequestAdapter

Build Status

npm install requestadapter

RequestAdapter exposes an interface for interacting with javascript request response objects on Node and in the browser in a simple, unified way. It is best used in combination with superagent.

var ra = new RequestAdapter(requestResponse);

Returns an ra instance.

var status = ra.status();

Returns the status code of the object.

var text = ra.text();

Returns the text of the response body.

var responseObject = ra.responseObject();

Returns the body as parsed JSON.

var headers = ra.allResponseHeaders();

Returns all the response headers.

Warning: This method only gives partial adapter support

  • In a Node environment the headers will be an object
  • In a browser environment the headers will be a concatenated string

var responseHeader = ra.responseHeader();

Returns the specified response header.

Warning: This method only gives partial adapter support

Header values differ between the browser and Node.

var rawReqResObject = ra.rawRequestResponse();

Returns the raw request response object instance for direct use.

var method = ra.method();

Returns the method, like GET or PUT

var methodLC = ra.methodLowerCase();

Returns the method in lower case form, like get or put

var url = ra.url();

Returns the URL of the request

FAQs

Package last updated on 08 Jun 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc