{"action":"created","issue":{"url":"https://api.github.com/repos/chimurai/http-proxy-middleware/issues/90","repository_url":"https://api.github.com/repos/chimurai/http-proxy-middleware","labels_url":"https://api.github.com/repos/chimurai/http-proxy-middleware/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/chimurai/http-proxy-middleware/issues/90/comments","events_url":"https://api.github.com/repos/chimurai/http-proxy-middleware/issues/90/events","html_url":"https://github.com/chimurai/http-proxy-middleware/issues/90","id":164597596,"number":90,"title":"Modifying the POST body in onProxyReq","user":{"login":"dvmorris","id":186253,"avatar_url":"https://avatars.githubusercontent.com/u/186253?v=3","gravatar_id":"","url":"https://api.github.com/users/dvmorris","html_url":"https://github.com/dvmorris","followers_url":"https://api.github.com/users/dvmorris/followers","following_url":"https://api.github.com/users/dvmorris/following{/other_user}","gists_url":"https://api.github.com/users/dvmorris/gists{/gist_id}","starred_url":"https://api.github.com/users/dvmorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvmorris/subscriptions","organizations_url":"https://api.github.com/users/dvmorris/orgs","repos_url":"https://api.github.com/users/dvmorris/repos","events_url":"https://api.github.com/users/dvmorris/events{/privacy}","received_events_url":"https://api.github.com/users/dvmorris/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/chimurai/http-proxy-middleware/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-07-08T19:13:42Z","updated_at":"2016-07-14T16:26:27Z","closed_at":null,"body":"Following this recipe: https://github.com/chimurai/http-proxy-middleware/blob/master/recipes/modify-post.md, I expect to be able conditionally modify the POST body based on the proxy path. The encodeURIComponent portion of this script only works with objects that are one level deep. \r\n\r\nHow do I make this work with any object, no matter how many levels deep it might go, or just bypass the onProxyReq method entirely for other URL's I don't care about?\r\n\r\n### Setup\r\n\r\n* body-parser: 1.15.1\r\n* http-proxy-middleware: 0.15.2\r\n* express: 4.13.4\r\n\r\n#### proxy middleware configuration\r\n```javascript\r\nconst apiProxy = proxyMiddleware('/services', {\r\n  target: config.serverUrl,\r\n  changeOrigin: true,\r\n  pathRewrite: {\r\n    '^/services': ''\r\n  },\r\n  onProxyReq: // just like the recipe linked above, but with a conditional check on proxy path\r\n```\r\n#### server mounting\r\n```javascript\r\nconst app = express();\r\napp.use(bodyParser.urlencoded({ extended: true }));\r\napp.use(bodyParser.json());\r\n\r\napp.use(apiProxy);\r\napp.listen(3000);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/chimurai/http-proxy-middleware/issues/comments/232717363","html_url":"https://github.com/chimurai/http-proxy-middleware/issues/90#issuecomment-232717363","issue_url":"https://api.github.com/repos/chimurai/http-proxy-middleware/issues/90","id":232717363,"user":{"login":"chimurai","id":655241,"avatar_url":"https://avatars.githubusercontent.com/u/655241?v=3","gravatar_id":"","url":"https://api.github.com/users/chimurai","html_url":"https://github.com/chimurai","followers_url":"https://api.github.com/users/chimurai/followers","following_url":"https://api.github.com/users/chimurai/following{/other_user}","gists_url":"https://api.github.com/users/chimurai/gists{/gist_id}","starred_url":"https://api.github.com/users/chimurai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chimurai/subscriptions","organizations_url":"https://api.github.com/users/chimurai/orgs","repos_url":"https://api.github.com/users/chimurai/repos","events_url":"https://api.github.com/users/chimurai/events{/privacy}","received_events_url":"https://api.github.com/users/chimurai/received_events","type":"User","site_admin":false},"created_at":"2016-07-14T16:26:27Z","updated_at":"2016-07-14T16:26:27Z","body":"Don't have to answer to your question unfortunately...\r\n\r\nThe recipe originated from this issue: #61 \r\n\r\nCan you post this question on StackOverflow with a backlinks between github <-> stackoverflow? In case someone runs into the same issue.\r\n\r\nThanks!"}}
{"actor":{"display_login":"chimurai"}}