...
If that is the case, the current request can be used to retrieve a new url, using the file-id that was obtained before
The Postman request:
...
Request configuration
a.- Headers
Standard headers, nothing to update here.
| Expand | ||
|---|---|---|
| ||
...
b.- Body
Values that are used for this demo (selected as Postman type RAW):
| Key | Value | Notes |
|---|---|---|
| fileId | "{{file-id}}" | file Id obtained before via a.1.1.2.- obtain fileId and a presigned URL to upload a big size document file (POST) |
| Expand |
|---|
...
c.- Pre-request script
Not used here
...
d.- Tests script
The following script is executed after the request is sent, to evaluate the response and also to set up environment variables (if they are needed for following requests)
| Code Block | ||||||||
|---|---|---|---|---|---|---|---|---|
| ||||||||
// following test will verify the expected response code for this request
pm.test("Status code is 204", function () {
pm.response.to.have.status(204);
});
// the following test will retrieve the updated url from the response headers
pm.test("location is not null", () => {
const headers = pm.response.headers.get('Location')
pm.expect(headers).not.eql('undefined');
if (headers !== undefined) {
console.log("upload-url:"+headers)
pm.environment.set("upload-url", headers);
}
});
|
...
Expected response
e.- Body
equal 1 for the success of the Put request
...
f.- Headers
The headers provide the updated url in the location entry. The post request test, takes care of updating the upload url on the environment conifguration
| Expand |
|---|
...
g.- Test results
This depends on the test we set up in the test script
...