PredixDev / predix-webapp-starter

A web application starter kit built on Polymer, Web Components, NodeJS and Predix UI Components
https://predix-webapp-starter.run.aws-usw02-pr.ice.predix.io
Other
61 stars 75 forks source link

Enable support for text and raw content in proxied requests. #19

Closed KevinVecchione closed 6 years ago

KevinVecchione commented 6 years ago

Unable to proxy requests with text and raw bodies without these parsers.

gstroup commented 6 years ago

I'm a little nervous about this one... thinking it might have some unintended consequences. I'll probably include the code, but commented out, along with some more comments. Can you explain exactly when you would need this? I guess you're not sending JSON in your requests, but sending HTML Form data? Thanks again.

KevinVecchione commented 6 years ago

Looks like you already had the necessary body parser for form data / application/x-www-form-urlencoded. By default the app was trying to convert everything to JSON, even if I was sending text/plain or application/octet-stream. Adding these parsers allowed more flexibility depending on the content-type of the request.

gstroup commented 6 years ago

That makes sense... I'll do some testing and make sure nothing else breaks. Thanks!

gstroup commented 6 years ago

We did some testing, and didn't see any problem. (Thanks @bsyk!) However, I decided to comment out the lines you added, since the webapp-starter doesn't need them "out of the box". Developers can un-comment these lines to include the text & raw body parsers if desired. Thanks for the contribution!

KevinVecchione commented 6 years ago

Makes sense, thanks.