Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow templates/string injection in request transformation #1006

Closed
ahmadnassri opened this issue Feb 18, 2016 · 2 comments
Closed

allow templates/string injection in request transformation #1006

ahmadnassri opened this issue Feb 18, 2016 · 2 comments
Labels
task/feature Requests for new features in Kong

Comments

@ahmadnassri
Copy link
Contributor

USE CASE

when doing consumer level transformations, it can get complex real fast, e.g.

{
  "consumer_id": "consumer-id-1",
  "api_id": "api-id",
  "name": "request-transformer",
  "config": {
    "add": {
      "querystring": {
        "consumer_id": "consumer-id-1" // manually plot the consumer id into a query string
      },
      "body": {},
      "headers": {}
    }
  }
}, {
  "consumer_id": "consumer-id-2",
  "api_id": "api-id",
  "name": "request-transformer",
  "config": {
    "add": {
      "querystring": {
        "consumer_id": "consumer-id-2" // manually plot the consumer id into a query string
      },
      "body": {},
      "headers": {}
    }
  }
}

a better alternative would be:

{
  "api_id": "api-id",
  "name": "request-transformer",
  "config": {
    "add": {
      "querystring": {
        "remote_api_key: {{ CONSUMER_ID }}"
      },
      "body": {},
      "headers": {}
    }
  }
}

this can become very useful when coupled with #550

other use cases include injecting additional properties from the execution logic, e.g. cluster info, server address, ports, etc ...

@jmdacruz
Copy link

jmdacruz commented May 2, 2016

I can also think about more complex transformations on the request-transformer plugin, such as duplicating headers with different names, transforming values of headers into query string parameters and viceversa, etc.

@ahmadnassri ahmadnassri added the BC label May 13, 2016
@thibaultcha thibaultcha added task/feature Requests for new features in Kong and removed BC labels Sep 1, 2016
@JnMik
Copy link

JnMik commented Nov 22, 2016

+ 1

@guanlan guanlan closed this as completed May 26, 2021
@Kong Kong locked and limited conversation to collaborators May 26, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
task/feature Requests for new features in Kong
Projects
None yet
Development

No branches or pull requests

7 participants