serviejs / popsicle-retry Goto Github PK
View Code? Open in Web Editor NEWEnable request retries for Popsicle
License: Other
Enable request retries for Popsicle
License: Other
Hi, this is a question - though very specific to popsicle-retry and its implementation - that's why I'm asking it here.
I'd like to use Popsicle to power an API SDK. The API supports an HTTP header-based replay feature, which allows to safely repeat a POST
or PUT
request - even if the original request has already been processed.
The header needs to carry two bits of information: a certain id
and a boolean flag
. If the boolean flag is set, the API backend will always look for a previous response and add a timing penalty before responding. If it is not set, it will process the request as it would normally do.
To properly use this feature, a normal request needs to carry headers id
and flag:false
. If the request times out and and is retried, it needs to carry headers id
and flag:true
. Is there a non-hacky way to achieve this? If not: at what point of the command chain does Popsicle fork the headers so that I could alter the flag right after? Thanks in advance.
Currently only EUNAVAILABLE
will trigger a retry https://github.com/blakeembrey/popsicle-retry/blob/6afcf29857538657341801c58b6d9391169e929e/src/index.ts#L35
Following codes needed to be added:
ETIMEDOUT
(text)520
(HTTP status code) infoHi, I am testing how pnpm works on some of the most popular Node packages. I was doing a pnpm install on the rxjs repo and I noticed that the prepublish script failed because popsicle-retry could not find popsicle.
I understand that this works with npm@3 and yarn, as they create a flat dependency tree, but is there a reason not to include popsicle as a dependency? You can at least include it as a peerDependency, I think.
It doesn't make sense to have it in devDependencies. You either need it in dependencies or in dev deps + peer deps, am I right?
I get a TypeScript error: node_modules/popsicle-retry/dist/index.d.ts(2,50): Error TS2307: Cannot find module 'popsicle'
.
this error is thrown by the following code in dist/index.d.ts
:
import { Request, Response, PopsicleError } from 'popsicle';
I have installed typings, typings-core depends on typings and typings-core depends on popsicle-retry.
help! :-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.