Tyk v2.2 Documentation Components

  1. Home
  2. Tyk v2.2 Documentation Components
  3. Request Body: Context Data

Request Body: Context Data

As of version 2.2 Tyk also allows context variables to be injected into the body using the ._tyk_context. namespace, unlike the context exposed to the URL rewriter and header injector, the body transform can fully iterate through list indices so, for example, calling _tyk_context.path_parts[0] in a template will expose the first entry in the path_parts list.

The context variables that are available are:

  • request_data: If the inbound request contained any query data or form data, it will be available in this object as a key:[]value map.
  • path_parts: The components of the path, split on /, it will be available in this object as a key:[]value map.
  • token: The inbound raw token (if bearer tokens are being used) of this user.
  • path: The path that is being requested.
  • remote_addr: The IP address of the connecting client.