-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: setting media type of file uploaded in multipart request
- Loading branch information
Showing
3 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"api-tuner": patch | ||
--- | ||
|
||
When uploading files in a multipart request, their media type can be defined using a third argument like `tuner:form ( "name" <file:path> "metia/type" )` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
PREFIX ex: <http://example.org/> | ||
prefix : <https://api-tuner.described.at/test#bodies/> | ||
PREFIX earl: <http://www.w3.org/ns/earl#> | ||
PREFIX tuner: <https://api-tuner.described.at/> | ||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | ||
PREFIX log: <http://www.w3.org/2000/10/swap/log#> | ||
PREFIX string: <http://www.w3.org/2000/10/swap/string#> | ||
|
||
:multiPartBodyTestCase | ||
a earl:TestCase ; | ||
rdfs:label "Multipart form upload" ; | ||
tuner:request [ | ||
a tuner:Request ; | ||
tuner:url <http://localhost:1080/body-multipart> ; | ||
tuner:method "POST" ; | ||
tuner:body [ | ||
tuner:form ( "upload" <file:tests/bodies/foobar.ttl> "text/turtle" ) ; | ||
] ; | ||
] | ||
. | ||
|
||
{ | ||
:multiPartBodyTestCase!tuner:request tuner:response ?res . | ||
|
||
?res tuner:http_code 200 . | ||
|
||
?res!tuner:body | ||
string:matches 'Content-Disposition: form-data; name=.upload.; filename=.foobar.ttl.\r\nContent-Type: text/turtle' ; | ||
. | ||
} => { | ||
:multiPartBodyTestCase earl:outcome earl:passed . | ||
} . |