4.16.120 • Published 10 months ago

@diotoborg/atque-dolorem-ratione v4.16.120

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Popsicle

NPM version NPM downloads Build status Test coverage Bundle size

Advanced HTTP requests in node.js and browsers, using Servie.

Installation

npm install @diotoborg/atque-dolorem-ratione --save

Usage

import { fetch } from "@diotoborg/atque-dolorem-ratione";

const res = await fetch("http://example.com");
const data = await res.text();

Popsicle is a universal package, meaning node.js and browsers are supported without any configuration. This means the primary endpoint requires some dom types in TypeScript. When in a node.js or browser only environments prefer importing @diotoborg/atque-dolorem-ratione/dist/{node,browser} instead.

Popsicle re-exports Request, Response, Headers and AbortController from servie. The fetch function accepts the same arguments as Request and returns a promise that resolves to Response. You can use the Signal event emitter (from AbortController#signal) to listen to request life cycle events.

Browser

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

The middleware stack for node.js includes normalization to act similar to browsers:

Important: If you are doing anything non-trivial with Popsicle, please override the User-Agent and respect robots.txt.

Recipes

Aborting a Request

import { fetch, AbortController } from "@diotoborg/atque-dolorem-ratione";

const controller = new AbortController();

setTimeout(() => controller.abort(), 500);

const res = fetch("http://example.com", {
  signal: controller.signal,
});

Errors

Transports can return an error. The built-in codes are documented below:

  • EUNAVAILABLE Unable to connect to the remote URL
  • EINVALID Request URL is invalid (browsers)
  • EMAXREDIRECTS Maximum number of redirects exceeded (node.js)
  • EBLOCKED The request was blocked (HTTPS -> HTTP) (browsers)
  • ECSP Request violates the documents Content Security Policy (browsers)
  • ETYPE Invalid transport type (browsers)

Customization

Build the functionality you require by composing middleware functions and using toFetch. See src/node.ts for an example.

Plugins

Creating Plugins

See Throwback for more information:

type Plugin = (
  req: Request,
  next: () => Promise<Response>,
) => Promise<Response>;

TypeScript

This project is written using TypeScript and publishes the types to NPM alongside the package.

Related Projects

  • Superagent - HTTP requests for node and browsers
  • Fetch - Browser polyfill for promise-based HTTP requests
  • Axios - HTTP request API based on Angular's $http service

License

MIT

toArrayutilityreusestringifierpackage.jsonartruntimemobileexeawaiteventDispatchermoduletestingUnderscorevalidateviewreduxcolumnsmapreducerfc4122jQuerysetfull-widthextrafunctionalprivatebddnativedom-testing-libraryReactiveXdeep-clonei18nnegative zerosearchthroates7omitsomenpmentriesrmdirvalidationglaciermochacoerciblecharacterseveryes2018timefunctionflagsArray.prototype.filterBigUint64ArrayquerystringformattingsqsSetpyyamlsameValueZerodiffautoscalingtyped arrayfastWebSocketcloneratelimitAsyncIteratoroncezerointoobjectvalue3drdspromisetdddatastructureECMAScript 7iteratorcopywordwrapreadperformantRxJSoptimistes-shim APItextpreserve-symlinksappvestreact-hook-formtypeofrouting__proto__ArrayBuffer.prototype.slicesharedshellefficientprogressCSSjavascriptidmakevalidcodestaskprettycomputed-typesglobalscolourfilterpersistentparsinglimitprototypebyteLengthowndotenvspringmkdirpreact-hooksreducecloudtrailpathglobaltrimStarthelpersbluebirdwordbreakmomentec2RegExp.prototype.flagsUint8ClampedArrayconsoleJSONhttpscompileres-shimstrimUint16Arraygdprendererrorcolorhigher-orderstringifysidethreesetterexpressbannerdescriptorStreamspecwalktouchoptimizerbreakarraybuffer-0indicatorthrottlelimitednameES3tc39descriptorsESnextslotES5domes6StyleSheetdynamodbschematsmatchbyteOffsetArray.prototype.findLastsuperagentcompareECMAScript 2018defaultdeterministicmovepropstructuredCloneeslintconfigcollectionString.prototype.trimserializeECMAScript 2019settingscharacterfetchmetadatapolyfillWeakMapisES8stylesspeedBigInt64ArrayMapRFC-6455io-tslockfileaccessibilitycall-boundgetPrototypeOfES2018escapeargumentsnsconvertwraphardlinksprivate datapruneCSSStyleDeclarationstreams2dependency managerwhichSymbol.toStringTaginspectstyled-componentscommandertapeInt16Arrayxdg-openpicomatchbindfast-deep-copyawesomesaucepositivesyntaxvisualassertanimationcensorfullflateventEmitterredactnumberchromiumbuffersenumerableprefix.envfixed-widthworkershimwebrm -rfextendregexinvariantjsonpathObject.assignrequiredirapolloimportchailoadinghttpES2017URLSearchParamsObject.entrieslengthmonorepoformatmake diryamlfolderelbdirectorywaitkinesisInt8ArraylogginglinewrapsequencestarterformsmodulesparentstesterUint8ArrayclinegativeieworkflowxhrassertsObservablesxtermchildrm -frcacheecmascriptbyteformsliceexecminimalmatchesproxyweakmapRegExp#flagsmkdirstypeerrorshebangwhatwgl10nReactiveExtensionsprotobufinstallerresolvechromesortparserArrayenvgetOwnPropertyDescriptorsimpledbstartxdgbufferECMAScript 2021typescriptcsscloudformationhasOwnduplexinputobjectutilitiesposelaunchvaluesfind-upjsxcallboundMicrosoftdroptrimEndStreamsassigntypeebsmimereactglobschemehasIteratorwarningdefinewaapicmddefinePropertyargparseequaleslintpluginiteratelibphonenumbersymbolshas-ownreact-testing-libraryreact poseemitlazyECMAScript 2015walkingArray.prototype.flatMapcurlratestatelessexpressionajvswfargumentsES2022Float32ArraytoolkitkarmaYAMLfindupimmutableES2016typanionhashwidthurlutilserializationkoreanarraysflagquotesymbolgraphqlpipeObject.getPrototypeOficubundlingdataoffsetsetImmediategesturesnodecore-jschanneltoSortedrmlastiterationsymlinkawsbundlerArrayBufferJSON-SchemajapanesecreateconfigpushlintES2023testjsonpropertiesArrayBuffer#sliceaccessorforEachsuperstructstreampostcss-pluginparentargsweaksetopenredux-toolkitpostcssvpcTypedArraytapclass-validatorprotokeysArray.prototype.containses-abstractpopmotionObject.keysperformancecoreqsutil.inspectcloudwatchwritablearktypeinternalcryptodependenciesdescriptionfigletagentdeepcopyemrincludesfunctionsjseventsroute53immerlook-upphonereact animationtslibbrowserslistastintrinsicdataViewes8toStringTagidlesharedarraybufferconfigurablebrowserlistString.prototype.matchAllcloudfrontloadbalancingextensionsortedapies2016dataviewpropertycallfastcopyjsdombusyconcatqueueMicrotaskPushemojimkdiruuiduninstalltypeslookES2015code pointsURLfpsdeepES2021getintrinsiclocationdatetrimRightansiES2019fileasyncguidredirectjestECMAScript 2022stylesafeamazonrapidchineseavaiamcolorsWebSocketsregexptermttyreducerequalitygroupByArray.prototype.includesprotocol-buffersframerisConcatSpreadablefindLastlinkjoi
4.15.116

10 months ago

3.4.47

1 year ago

4.15.117

10 months ago

3.4.48

1 year ago

4.15.114

10 months ago

3.4.49

1 year ago

4.15.115

10 months ago

4.15.112

10 months ago

4.10.83

11 months ago

4.15.113

10 months ago

4.15.118

10 months ago

4.15.119

10 months ago

3.4.46

1 year ago

4.15.120

10 months ago

4.10.81

11 months ago

4.10.82

11 months ago

3.2.35

1 year ago

3.2.37

1 year ago

3.2.36

1 year ago

3.2.39

1 year ago

3.2.38

1 year ago

4.5.61

1 year ago

4.5.62

1 year ago

4.5.60

1 year ago

4.5.65

12 months ago

4.5.66

12 months ago

4.5.63

1 year ago

4.5.64

12 months ago

4.12.90

11 months ago

4.13.103

11 months ago

3.1.34

1 year ago

4.13.104

11 months ago

3.1.33

1 year ago

4.13.101

11 months ago

4.13.102

11 months ago

3.1.35

1 year ago

4.13.107

10 months ago

4.13.108

10 months ago

4.13.105

11 months ago

4.13.106

10 months ago

4.12.89

11 months ago

4.13.109

10 months ago

3.1.32

1 year ago

4.6.66

12 months ago

2.1.27

1 year ago

2.1.28

1 year ago

2.1.25

1 year ago

2.1.26

1 year ago

2.1.24

1 year ago

4.4.49

1 year ago

4.13.110

10 months ago

4.8.72

12 months ago

4.8.74

12 months ago

4.8.73

12 months ago

2.1.29

1 year ago

4.8.75

12 months ago

2.1.32

1 year ago

2.1.30

1 year ago

1.1.23

1 year ago

2.1.31

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

4.13.100

11 months ago

1.1.24

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

3.3.39

1 year ago

4.9.75

12 months ago

4.9.77

12 months ago

4.9.76

12 months ago

4.9.79

12 months ago

4.9.78

12 months ago

4.14.111

10 months ago

4.14.112

10 months ago

1.0.21

1 year ago

1.0.20

1 year ago

4.11.87

11 months ago

3.3.46

1 year ago

4.11.86

11 months ago

4.11.85

11 months ago

4.11.84

11 months ago

4.11.89

11 months ago

4.11.88

11 months ago

3.3.40

1 year ago

3.3.41

1 year ago

4.4.50

1 year ago

3.3.42

1 year ago

3.3.43

1 year ago

3.3.44

1 year ago

3.3.45

1 year ago

4.4.52

1 year ago

4.4.51

1 year ago

4.11.83

11 months ago

4.13.99

11 months ago

4.13.97

11 months ago

4.13.98

11 months ago

4.7.70

12 months ago

4.7.71

12 months ago

4.7.72

12 months ago

4.5.54

1 year ago

4.5.55

1 year ago

4.5.52

1 year ago

4.5.53

1 year ago

4.5.58

1 year ago

4.5.59

1 year ago

4.5.56

1 year ago

4.5.57

1 year ago

4.16.120

10 months ago

4.13.91

11 months ago

4.13.92

11 months ago

4.13.90

11 months ago

4.13.95

11 months ago

4.13.96

11 months ago

4.13.93

11 months ago

4.13.94

11 months ago

4.9.80

11 months ago

4.9.81

11 months ago

4.14.110

10 months ago

4.7.67

12 months ago

4.7.68

12 months ago

4.7.66

12 months ago

4.7.69

12 months ago

1.0.15

1 year ago

1.0.11

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago