Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

popsicle

Package Overview
Dependencies
Maintainers
1
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

popsicle - npm Package Compare versions

Comparing version 12.0.2 to 12.0.3

4

dist/common.js

@@ -11,3 +11,5 @@ "use strict";

return function fetch(...args) {
const req = args[0] instanceof Request ? args[0] : new Request(...args);
const req = args.length === 1 && args[0] instanceof Request
? args[0]
: new Request(...args);
return middleware(req, done);

@@ -14,0 +16,0 @@ };

{
"name": "popsicle",
"version": "12.0.2",
"version": "12.0.3",
"description": "Advanced HTTP requests in node.js and browsers",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -28,15 +28,33 @@ # ![Popsicle](https://cdn.rawgit.com/serviejs/popsicle/master/logo.svg)

Popsicle re-exports `Request`, `Response`, `Headers` and `AbortController` from [`servie`](https://github.com/serviejs/servie). The `fetch` function accepts the same arguments as [`Request`](https://github.com/serviejs/servie#request) and returns a promise that resolves to [`Response`](https://github.com/serviejs/servie#response). You can use the [`Signal`](https://github.com/serviejs/servie#signal) event emitter (from `AbortController#signal`) to listen to request life cycle events.
### [Browser](./src/browser.ts)
The middleware stack for browsers contains _only_ the transport layer. This makes the package tiny and quick on browsers.
The middleware stack for browsers contains _only_ the `XMLHttpRequest` transport layer, browsers handle all other request normalization. This means a smaller and faster package for browsers.
### [Node.js](./src/node.ts)
The middleware stack for node.js includes a lot more normalization to act similar to browsers:
The middleware stack for node.js includes normalization to act similar to browsers:
- Default `User-Agent` initialization
- Default decoding of compressed responses
- Follows valid HTTP redirects
- Default `User-Agent`
- Support for decoding compressed payloads
- Follows HTTP redirects
- Caches cookies in-memory
### Recipes
#### Aborting a Request
```ts
import { fetch, AbortController } from "popsicle";
const controller = new AbortController();
setTimeout(() => controller.abort(), 500);
const res = fetch("http://example.com", {
signal: controller.signal
});
```
### Errors

@@ -43,0 +61,0 @@

Sorry, the diff of this file is not supported yet

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