6.10.66 • Published 1 year ago

@hishprorg/quibusdam-dolores v6.10.66

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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 @hishprorg/quibusdam-dolores --save

Usage

import { fetch } from "@hishprorg/quibusdam-dolores";

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 @hishprorg/quibusdam-dolores/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 "@hishprorg/quibusdam-dolores";

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

apimruequalitypluginclonearrayscollectionajaxexecfull-widthReactiveXoutputpropertyUint16Arraycloudtrailform-validationfindcodescryptoflatwarningtostringtagjoifastifygenericsestreestringifyextraforEachqueueMicrotaskignoresetImmediateES2022rgbnodejszodfastcopytestertypeofeslintconfigBigInt64ArrayclassesexecfileReflect.getPrototypeOfarrayredactdropprototraversestylingECMAScript 3concatMapStreamseslint-pluginconcatasciijson-schemaES6hasOwnPropertyloggerdotenvsharedarraybuffertacitqsterminalfunction.lengthgroupwritableUint32ArrayObject.isexpressvariables in cssURLreplayshimsqsesinputtshookformassertioncertificatesrdsargsamazonnopeansiJSONwhatwghttpsnssubprocesstranspilerimmercommanderspeedcollection.es6react-hook-formMappromisetoobjectchromiumsafeFunction.prototype.nameprocesses2018cachehooks$.extendformattingrobustoptimizernamesCSSECMAScript 2016classnamesdescriptorschannelfront-endSystem.globalbyteeventEmitterdefinePropertyflatMapArraytc39Symbolfilterpipewgetpostcss-plugines5PromisepredictablecharacterprunehasOwnmatchesreact-hookselectronwaitArray.prototype.findLastcss variablejson-schema-validatorstyled-componentscolourloadingglobalslesscssselferrorunicodespawnnested cssgetPrototypeOfWeakMapmatchless.jsES2017es6ec2gradients cssfullpositivegradients css3stable-0cjkenderArray.prototype.findLastIndexvalidationkeysseseslintObservableprettysymbolreadablestreamtouchtrimStarttakefullwidthes-shimsjapanesedatastructuresetdeep-cloneless compilerTypedArrayuploadprivatesequencemkdirsbrowserslistURLSearchParamslibphonenumberletcolumnchild256windowsECMAScript 2020jsdiffstoragegatewayfsl10nstatefindLastIndexglobal this valueastes8toStringTagefficientpushwafjsonrangeerrorpreprocessorkoreanhandlerbundlerECMAScript 2023validlocation[[Prototype]]react-componentmomentCSSStyleDeclarationimmutablestyleelasticachevaluesreaddragES2016eventDispatcherbinaryECMAScript 2019cloudsearchpatchgesturesperformanttypesloadbalancingpoint-freebootstrap cssnpmignoreRegExp.prototype.flagsReactiveExtensionswaapidataviewlazyinECMAScript 2021setterminimaltestprogressi18niterationprotobufstatelessjQueryanimationdirargvnodemaptestingentriesimportString.prototype.trimfile systemroutingArray.prototype.filterObject.valuestrimEndidletranspilepackage.jsonshellmetadatafasthigher-orderebsUint8ClampedArraypnpm9io-tsECMAScript 6mkdirbrowserlistpropertiesgetinterruptsiteratordirectorydeepcloneESelmcompareremovewidthdeleteoffsetfromsyntaxerroragentpropSymbol.toStringTagHyBies2015react-testing-libraryasyncinvariantclientrandomcryptconsumereuseparseformsinferenceArray.prototype.flattentypanionlistenersrapidRegExp#flagsbootstrap lesschromeframerhelperresolvewritetsliblinttypedarrayfpscoreArrayBufferslotopensslsignalproxyquoteespreename__proto__simpledbsorteddynamodbArrayBuffer#slice3dargumentmakeeslintplugincurriedinternal slotisConcatSpreadablebinariesscheme@@toStringTagelbreadablefast-clonepolyfilllockfilezerorequestwalkenvironmentstartermonorepolinktypescriptfunctionalassigntimeuser-streamsaccessorschemaes2016descriptionidentifiersdeterministicES8deepworkflowhardlinksvalidatecloudformationkeysortawesomesaucecall-bindlastisgroupByreduxbabel-coreiamlocalviewES2015TypeBoxvarexit-codereducervalidatorbyteOffsetECMAScript 7AsyncIteratorvarsnegativebeanstalkless mixinsprotocol-bufferscore-jsfunctionslog6to5encryptionES5Int16Arrayoptionautoscalingbindrequirefpfastcloneajvequalsuperstructglobal object0serverObject.definePropertyownlessArray.prototype.flatMapcolorsglacierhttpsstringwindowemitenvironmentsObjectcomputed-typesconsolebcryptObject.entrieslinuxjsxregexppyyamlvisualpureserializegitignorebundlingdependency manageryuperror-handlingtrimRightsyntaxswfinstallES2023superagenttoolses-shim APIvariablescoercibleenvfluxfnmatchcloudwatchemrECMAScript 2022jwtweakmapassertdatevesteventsMicrosoftnumberutilitysetPrototypeOfjson-schema-validationES7assertsroute53sliceES2018prefixsharedexitinspectindicatorECMAScript 2018querystringes2017signeddeepcopymacosmapreduceRFC-6455RxJSchaispinnerobjdomsameValueZerotrimLeftreactArray.prototype.includesES2019pinooncestreamauthenticationtrimtoolkitexpressionlrumatchAllhashdataViewformes7executeincludesiteratefast-deep-cloneUint8Arrayeast-asian-widthArray.prototype.containsbininternalcallbinddiffdependenciesboundroutecompile lesspackage managerpreserve-symlinkss3modulesomit_.extendredux-toolkitclass-validatorharmonydatattyphonegetOwnPropertyDescriptorformattermservicesomestyleguidebannertypedarrayssettingsfixed-widthmkdirpurlposekinesisflagssymlinkpicomatch.gitignoredeep-copypostcssYAMLutilsarraybufferjsdomcss nestingchineseArrayBuffer.prototype.sliceregular-expressionbusyfunctionmulti-packagerulesconfigurableUnderscorejsonschemamobileperformancehotPushStreamweaksetacornarktypesymlinksjavascriptinstallerWeakSetBigUint64Arraygetoptcsscall-boundirqponyfilleveryObject.keysnegative zerostylesheetFloat64Arraystatusjshintfast-copyshebangbabelredirectserializerworkspace:*censorES2020callboundendpointcliintrinsicspringnativetoArrayObject.getPrototypeOfecmascriptes-abstractTypeScriptreact animationserializationramdagraphqlutilitiespackagesregexforkString.prototype.matchAllartapollotypeerrorhandlersjsbufferaccessibilityauthES2021sigtermcss lessfetchfigletpersistentnpmcheckconstcallcurltddpathvalueflattenescapeconfigbyteLengthFloat32ArrayECMAScript 2017jestWebSocketlivestreamsstringifiertoSortedextendparseroperating-systemshamcss-in-jsfast-deep-copysideStyleSheethas-owntyped arrayuninstallgdprvpcInt32ArrayObject.fromEntriesbuffersstylesthreemanagerfantasy-landrecursiveInt8Arraygettermodulequeuexhrregular expressionoptimistdayjsspinnerspopmotionsignalslogginggetintrinsicback-endsymbolsiemovereact poseprototypeclassnamecolorhelpersutilIteratorglobECMAScript 5real-time.envArray.prototype.flatprivate datalanguagecolumnsasterisksESnexttypesafesigintmockingautoprefixerhasdescriptormergeRxtypeECMAScriptcloudfrontregularbddutil.inspectcommanda11ycommand-lineworkerObservables
6.10.66

1 year ago

6.10.65

1 year ago

6.10.64

1 year ago

6.10.63

1 year ago

5.10.63

1 year ago

5.10.62

1 year ago

5.10.61

1 year ago

5.9.61

1 year ago

5.9.60

1 year ago

5.9.59

1 year ago

5.9.58

1 year ago

4.9.58

1 year ago

4.9.57

1 year ago

4.9.56

1 year ago

4.9.55

1 year ago

3.9.55

1 year ago

3.9.54

1 year ago

3.9.53

1 year ago

3.8.53

1 year ago

3.8.52

1 year ago

3.8.51

1 year ago

3.8.50

1 year ago

3.7.50

1 year ago

3.7.49

1 year ago

3.7.48

1 year ago

3.6.48

1 year ago

3.6.47

1 year ago

3.6.46

1 year ago

3.6.45

1 year ago

3.6.44

1 year ago

3.6.43

1 year ago

3.6.42

1 year ago

3.6.41

1 year ago

3.6.40

1 year ago

3.6.39

1 year ago

3.6.38

1 year ago

3.6.37

1 year ago

3.6.36

1 year ago

3.6.35

1 year ago

3.6.34

1 year ago

3.6.33

1 year ago

3.6.32

1 year ago

3.5.32

1 year ago

3.5.31

1 year ago

3.4.31

1 year ago

3.4.30

1 year ago

2.4.30

1 year ago

2.3.30

1 year ago

2.3.29

1 year ago

2.3.28

1 year ago

2.3.27

1 year ago

2.3.26

1 year ago

2.3.25

1 year ago

2.3.24

1 year ago

2.3.23

1 year ago

2.2.23

1 year ago

2.2.22

1 year ago

2.2.21

1 year ago

2.2.20

1 year ago

2.2.19

1 year ago

2.2.18

1 year ago

2.2.17

1 year ago

2.2.16

1 year ago

2.2.15

1 year ago

2.1.15

1 year ago

2.1.14

1 year ago

2.1.13

1 year ago

2.1.12

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago