Skip to main content
Version: Current

Adapter


Introduction

Adapter is a function that is responsible for communication with the server. The default adapter is used to communicate with the REST server. However, there is nothing to prevent you from changing this and creating the adapter you need. Thanks to event communication, you can set your own adapter as you wish.

By default, the adapter is responsible for requests, but its role is very significant for many other elements – such as tracking the progress of requests, listening for cancellation, and mapping payloads and headers. It also applies to all the interceptors in the requesting lifecycle.

caution

If there is no XHR in the window object or the XHR object is a polyfill in your environment, you’ll have to install the npm package xmlhttprequest and set it on the window object. Otherwise we will use the node http module.


Preview

adapter(request, requestId)


Purpose

  • Requests handler for client dispatchers
  • Provides flexibility via handler changeability