Skip to content
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

request_transformer not adding key:value to message body #529

Closed
bisoldi opened this issue Sep 2, 2015 · 6 comments
Closed

request_transformer not adding key:value to message body #529

bisoldi opened this issue Sep 2, 2015 · 6 comments
Assignees
Labels
idea/new plugin [legacy] those issues belong to Kong Nation, since GitHub issues are reserved for bug reports.

Comments

@bisoldi
Copy link

bisoldi commented Sep 2, 2015

I've setup two services, one I wrote in Java with an interceptor as well as a mockbin service, both of which show the insertion into the query string and header by the request_transformer. I can't get confirmation that the insertion into the message body is taking place.

The mockbin is located at: http://www.mockbin.com/bin/e4dee421-0e16-482d-ba69-4b507bef3346/log

Below is my Kong configuration:

$ curl -X GET http://localhost:8001/apis
{
  "data": [
    {
      "path": "\/mock",
      "target_url": "http:\/\/www.mockbin.com\/bin\/e4dee421-0e16-482d-ba69-4b507bef3346",
      "created_at": 1441216341000,
      "id": "07ecccc6-e7a2-494d-c95d-f4e8bcc436c9",
      "name": "mock",
      "strip_path": true
    }
  ]
}
$ curl -X GET http://localhost:8001/apis/mock/plugins
{
  "data": [{
    "api_id": "07ecccc6-e7a2-494d-c95d-f4e8bcc436c9",
    "id": "5ea3f322-f77e-4dbf-cd7d-70a353089b1e",
    "value": {
      "add": {
        "querystring": ["testQueryStrKey:20u3ihf2ku1khe89"],
        "headers": ["testHeaderKey:20u3ihf2ku1khe89"],
        "form": ["testBodyKey:20u3ihf2ku1khe89"]
      }
    },
    "enabled": true,
    "name": "request_transformer",
    "created_at": 1441216373000
  }]
}

Below are the 3 commands I issued:

curl -X POST -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/mock/ -d '{"name":"Mike"}'
curl -X GET -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/mock/
curl -X PUT -H "Content-Type: application/json" -H "Accept: application/json" http://localhost:8000/mock/ -d '{"name":"Mike"}'
@ahmadnassri
Copy link
Contributor

@bisoldi seems like your example of the JSON output from /apis is duplicated, can you please update the ticket?

P.S. I cleaned up the formatting.

@ahmadnassri
Copy link
Contributor

as for the actual issue, I just tested locally and reviewed your mockbin example, it seems you're sending an application/json content-type for the request ... which is the problem

the request_transformer plugin currently only supports Form Data (a.k.a content type of: application/x-www-form-urlencoded)

@ahmadnassri ahmadnassri self-assigned this Sep 2, 2015
@bisoldi
Copy link
Author

bisoldi commented Sep 3, 2015

Thank you for the help with that. I think it would be beneficial if the documentation for the plugin (likely the response transformer as well?) clearly stipulated that requirement.

@sonicaghi
Copy link
Member

@thefosk ^

@sonicaghi sonicaghi reopened this Sep 3, 2015
@ahmadnassri
Copy link
Contributor

Thank you for the help with that. I think it would be beneficial if the documentation for the plugin (likely the response transformer as well?) clearly stipulated that requirement.

agreed

@subnetmarco subnetmarco added the idea/new plugin [legacy] those issues belong to Kong Nation, since GitHub issues are reserved for bug reports. label Sep 17, 2015
@subnetmarco
Copy link
Member

Closing this in favor of #569.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea/new plugin [legacy] those issues belong to Kong Nation, since GitHub issues are reserved for bug reports.
Projects
None yet
Development

No branches or pull requests

4 participants