mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[@types/got] Support retries of "POST" method (#35000)
* [@types/got] Support retries of "POST" method The current list of supported methods for RetryOptions omits the "POST" method. I believe this is because the list was taken from https://www.npmjs.com/package/got#retry however this is only the _default_ methods that are supported. [This issue](https://github.com/sindresorhus/got/issues/757) from the `got` GitHub repo indicates that it _is_ possible to specifically state that you would like to retry on POST as well. I have a use-case where I'd like to automatically retry failed POSTs but can't right now without overriding the typing. * Add @ryanwilsonperkin to authors list To allow dt-bot to ping me of changes to these interfaces and to help support additional typing changes. * Add test that "POST" is a supported method * Match order of other method lists Every other list of methods puts POST before PUT. Minor point, but may as well match convention. * fix: Remove duplicate POST
This commit is contained in:
committed by
Pranav Senthilnathan
parent
8445dd431b
commit
7bb03173ee
@@ -306,7 +306,7 @@ got('http://todomvc.com', { retry: 2 });
|
||||
got('http://todomvc.com', {
|
||||
retry: {
|
||||
retries: 2,
|
||||
methods: ['GET'],
|
||||
methods: ['GET', 'POST'],
|
||||
statusCodes: [408, 504],
|
||||
maxRetryAfter: 1,
|
||||
errorCodes: ['ETIMEDOUT']
|
||||
|
||||
3
types/got/index.d.ts
vendored
3
types/got/index.d.ts
vendored
@@ -5,6 +5,7 @@
|
||||
// Konstantin Ikonnikov <https://github.com/ikokostya>
|
||||
// Stijn Van Nieuwenhuyse <https://github.com/stijnvn>
|
||||
// Matthew Bull <https://github.com/wingsbob>
|
||||
// Ryan Wilson-Perkin <https://github.com/ryanwilsonperkin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
@@ -251,7 +252,7 @@ declare namespace got {
|
||||
|
||||
interface RetryOptions {
|
||||
retries?: number | RetryFunction;
|
||||
methods?: Array<'GET' | 'PUT' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'TRACE'>;
|
||||
methods?: Array<'GET' | 'POST' | 'PUT' | 'HEAD' | 'DELETE' | 'OPTIONS' | 'TRACE'>;
|
||||
statusCodes?: Array<408 | 413 | 429 | 500 | 502 | 503 | 504>;
|
||||
maxRetryAfter?: number;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user