@tinkoff/request

@tinkoff/request

  • How to
  • Plugins
  • Internals
  • GitHub

›How to

Core

  • Core
  • Context
  • Request execution
  • Plugin

Plugins

  • Plugins
  • Batch
  • Cache - Deduplicate
  • Cache - Fallback
  • Cache - Memory
  • Cache - Etag
  • Cache - Persistent
  • Log
  • Protocol - Http
  • Protocol - Jsonp
  • Transform - Url
  • Validate
  • Circuit Breaker
  • Prom RED metrics
  • Retry

How to

  • How to

How to

Write your own plugin

Plugin is just a plain object with specific keys.

Plugin interface (all entries are optional):

  1. shouldExecute(context) - boolean function indicating is plugin should execute at current phase
  2. init(context, next, makeRequest?) - this function will be called at init phase
  3. complete(context, next, makeRequest?) - this function will be called at complete phase
  4. error(context, next, makeRequest?) - this function will be called at error phase

context - the current request execution context, an object with specific methods to change request state (request data, response, error, meta data) next - callback function which should be called after plugin did its job. makeRequest - function to make request (it will be executed with current settings)

← Retry
  • Write your own plugin
Copyright © 2023 tinkoff.ru