github.com/hellofresh/janus@v0.0.0-20230925145208-ce8de8183c67/docs/plugins/request_transformer.md (about)

     1  # Request Transformer
     2  
     3  Transform the request sent by a client on the fly on Janus, before hitting the upstream server.
     4  
     5  ## Configuration
     6  
     7  The plain request transformer config:
     8  
     9  ```json
    10  "request_transformer": {
    11      "enabled": true,
    12      "config": {
    13          "add": {
    14              "headers": {
    15                  "X-Something": "Value"
    16              },
    17              "querystring": {
    18                  "test": "value"
    19              }
    20          },
    21          "append": {
    22              "headers": {
    23                  "X-Something-More": "Value"
    24              },
    25              "querystring": {
    26                  "extra": "stuff"
    27              }
    28          },
    29          "replace": {
    30              "headers": {
    31                  "X-Something": "New Value"
    32              },
    33              "querystring": {
    34                  "test": "new value"
    35              }
    36          },
    37          "remove": {
    38              "headers": {
    39                  "X-Something": ""
    40              },
    41              "querystring": {
    42                  "test": ""
    43              }
    44          }
    45      }
    46  }
    47  ```
    48  
    49  
    50  Here is a simple definition of the available configurations.
    51  
    52  | Configuration                 | Description                                                         |
    53  |-------------------------------|---------------------------------------------------------------------|
    54  | name                          | Name of the plugin to use, in this case: request-transformer        |
    55  | config.remove.headers         | List of header names. Unset the headers with the given name.        |
    56  | config.remove.querystring     | List of querystring names. Remove the querystring if it is present. |
    57  | config.replace.headers        | List of headername:value pairs. If and only if the header is already set, replace its old value with the new one. Ignored if the header is not already set.        |
    58  | config.replace.querystring    | List of queryname:value pairs. If and only if the header is already set, replace its old value with the new one. Ignored if the header is not already set. |
    59  | config.add.headers            | List of headername:value pairs. If and only if the header is not already set, set a new header with the given value. Ignored if the header is already set.        |
    60  | config.add.querystring        | List of queryname:value pairs. If and only if the querystring is not already set, set a new querystring with the given value. Ignored if the header is already set. |
    61  | config.append.headers         | List of headername:value pairs. If the header is not set, set it with the given value. If it is already set, a new header with the same name and the new value will be set.        |
    62  | config.append.querystring     | 	List of queryname:value pairs. If the querystring is not set, set it with the given value. If it is already set, a new querystring with the same name and the new value will be set. |
    63  
    64  ## Order of execution
    65  
    66  Plugin performs the response transformation in following order
    67  
    68  `remove --> replace --> add --> append`