Can Swagger UI for Openapi v3 handle arrays in multipart requests?
I have the following Openapi document: { "info": { "description": "This document shows strange behavior in swagger ui", "title": "This document shows a strange behavior in swagger ui", "version": "0.0.0" }, "openapi": "3.0.0", "paths": { "/post": { "post": { "description": "Upload multiple files", "requestBody": { "content": { "multipart/form-data": { "schema": { "properties": { "inputResources": { "items": { "type": "string" }, "type": "array" } }, "type": "object" } } }, "description": "Multipart body to upload files" } } }, }, "servers": [ { "url": "https://httpbin.org" } ] } I want to display it with Swagger UI so I created the following HTML page: <script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script> <script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-standalone-preset.js"> </script> <script> window.onload = function() { const ui = SwaggerUIBundle({ url: "path/to/above/document", validatorUrl : null, dom_id: '#swagger-ui', deepLinking: true, }) window.ui = ui } </script> <div id="swagger-ui"></div> I get a nice display of my request However when I execute it the following multipart body is sent: ------WebKitFormBoundaryzRaOvYA1aX8T4BXu Content-Disposition: form-data; name="inputResources" ewrr,eeee ------WebKitFormBoundaryzRaOvYA1aX8T4BXu-- As you see the strings are just comma-separated which is not a valid way to encode an array of strings in a multipart body. I would expect a part for each string element to be created like that: ------WebKitFormBoundaryzRaOvYA1aX8T4BXu Content-Disposition: form-data; name="inputResources" ewrr ------WebKitFormBoundaryzRaOvYA1aX8T4BXu Content-Disposition: form-data; name="inputResources" eeee ------WebKitFormBoundaryzRaOvYA1aX8T4BXu-- Even worse when I change the format of the inputResources property to binary to send files instead. "inputResources": { "items": { "format": "binary", "type": "string" }, "type": "array" } This changes the multipart body to the following: ------WebKitFormBoundary5OvyKi6BDAuPKnFm Content-Disposition: form-data; name="inputResources" [object File],[object File] ------WebKitFormBoundary5OvyKi6BDAuPKnFm-- Again I would have expected two parts with the respective file's binary content. Am I assuming correctly that Swagger UI simply does not support arrays yet in multipart request bodies? Or did I do something wrong? Kind regards, Neidhartmultipart/form-data w/ boundaries - request failing - same headers/body pass using fiddler
This is my first post, first impassable issue I have run into with soap ng so far. I am testing a batch upload service for work and I have used fiddler for a sanity check before trying to create a regression suite for the service with soap ng. The sanity check through fiddler works fine, but the exact same test throughsoap ng is failing. The only difference between the two that I can see is the content-length is larger with soap ng. The content-length for this service is important and the request through fiddler will fail if it is not correct. I have tried to manually specify the content-length insoap ng but the request instantly fails when I do this, it looks like it doesn't even try to connect to the endpoint at all. I get back "<missing raw response data>" when manually specifying the content-length. At this point I am thinking the content-length is the culprit. I will post screenshots of the two applicatons with the tests loaded. If anyone has experience using multipart content types with boundaries and soap ng, please advise how you have gotten your tests to work. The fiddler setup is working, I copied that as close as possible tosoap ng which is failing. fiddler content-length = 616 soap ng content-length = 757 (where is the extra length coming from?) SOAP NG REQUEST FIDDLER REQUEST6.9KViews0likes3CommentsIn a REST request , how can I submit a Content-Type for each part in multipart request
I'm trying to use SoapUI to test a REST service that accepts a multipart POST. The first part being JSON, the second being a file. I've been able to tell SoapUI to submit the request as multipart and build the partsfrom the QUERY parameters. The problem:I can't find a way to tell SoapUI to use a Content-Type: application/json header for the first part in the multipart request -Is this a feature that is supported by SoapUI (or could be added?) Here is as far as I've gotten: POST http://localhost:8080/rest/path/hello.txt HTTP/1.1 Accept-Encoding: gzip,deflate Content-Type: multipart/form-data; boundary="----=_Part_33_1474532169.1469024696152" MIME-Version: 1.0 Content-Length: 29328 Host: localhost:8080 Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) ------=_Part_33_1474532169.1469024696152 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: form-data; name="indexfields" { "firstname" : "hello", "lastname" : "world" } ------=_Part_33_1474532169.1469024696152 Content-Type: application/pdf Content-Transfer-Encoding: binary Content-Disposition: form-data; name="file"; filename="example-file.pdf" ....1KViews0likes0Comments