-
Notifications
You must be signed in to change notification settings - Fork 360
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 Binary Requests To Succeed in Prism Proxy Mode #2376
Comments
Thanks for the question @travisgosselin - I'm getting clarification from the team so we can update the docs to be more clear. Thinking about future enhancements... is your use case primarily xlsx, csv, and txt uploads on linux? |
Thanks for the quick response @ryotrellim. |
One more question @travisgosselin:
Can you say more about what validation you expect? Do you have an example OAS? AFAIk, we haven't historically validated non-json objects. |
hmmm... the way I wrote that, I think it can be interpreted as the opposite of what I was saying. I'll try to clarify: Original Intent
I intended to indicate that the proxy actually worked just fine with large Further ConsiderationAt this point, I'd be happy with support of just passing the multipart payload through without any validation. But, there is an opportunity I think to validate the multipart form names for binary formatted data, and potentially deeper validation for the rest of the data. Consider an endpoint like this in OAS:
In the above example, I can send a CURL request and indicate the profileImage named in the multipart upload:
However, I noticed when testing with Prism, that the name within the "schema" is not validated... in this case
Of course, the server itself may file if looking for a particular named file of Additionally, non-binary data could be validated as a future enhancement potentially. Further validation or attempt to validate could be determined based on contentType specification as well. My reference for the OAS usage of multipart is here: https://swagger.io/docs/specification/describing-request-body/multipart-requests/ However, at this time, my hope and necessary MVP is to just at minimum proxy the multipart/form-data through without any validation to at least keep validation working on this endpoint (without bypassing it) for other content types... like the example I have above also allows for |
this might not be really related to multipart but more about handling binary files - see #2349 |
The fix for this has been released in version 5.3.2. |
There are varying behaviors I have noticed when working with
multipart/form-data
request bodies behind the prism proxy. First off, I understand that according to your documentation you do not supportmultipart/form-data
or binary files:https://docs.stoplight.io/docs/prism/1593d1470e4df-concepts#content-negotiation
I'd like to understand what "support" means specifically for
proxy
mode? For example, does it mean that you do not validate or log any discrepancies in these request/response bodies, but still forward the bodies through? Or does it mean that the proxy is expected to completely fail if it sees a content type ofmultipart/form-data
?In some observation, I have noticed that:
V4.14.1 of the Prism Proxy
xlsx
file it succeeds and proxies the file through (though it doesn't validate the schema as I would expect). When passing largecsv
ortxt
files it also works and proxies it along when executing the local CLI on a Windows OS.stoplight/prism:4.14.1
, the exact same series of requests fail:I expect that there is a platform-specific reason this functions properly on Windows but not within the Linux-based container provided?
V5.3.1 of the Prism Proxy
When making a request with an
xlsx
file it will fail with the following error and the proxy will shut down even while executing locally on the same Windows platform:Passing other
csv
ortxt
payloads seems to work as long as there are no special characters in the payload (such as%
) which causes the prism proxy to crash with the same error. It would seem no tagged container exists for testing it on Docker yet... but I did try "master" tag and it resulted in similar failure as well.What is Supported?
Even though the documentation notes there is no support for multipart/form-data, I do see this recently completed merge that is noted for release in v5.2.0: #2321 . Not sure if this is intended to support the use cases I describe above or if it is something more targeted.
Your guidance in indicating if multipart/form-data in part or in whole can be used to pass through the proxy would be appreciated (even if just not validated would be fine), including expectations on usage on different platforms (windows vs linux).
The text was updated successfully, but these errors were encountered: