Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
type: json
content: |-
{
"signature": "",
"signature": "{{proof_signature_base64}}",
"data": []
}
examples: ./.resources/Capture Signature for Order.resources/examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ pathVariables:
value: "{{order_id}}"
description: (Required) The id of the order to update.
- key: placeId
value: "{{place_id}}"
description: (Required) The pickup, dropoff, or waypoint place id to set as the current destination.
value: "{{waypoint_id}}"
description: (Required) The pickup, dropoff, or waypoint place id to set as the current destination. It must belong to this order's payload — a place that is not one of the order's stops is rejected with "Place resource is not a valid destination."
body:
type: json
content: ""
Expand Down
21 changes: 17 additions & 4 deletions postman/collections/Fleetbase Core API/.resources/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,23 @@ scripts:
pm.expect(pm.response.code, `got HTTP ${pm.response.code}`).to.be.oneOf(expected);
});

pm.test(`${pm.info.requestName} returns a JSON body`, function () {
pm.expect(pm.response.headers.get('Content-Type') || '').to.include('json');
pm.expect(() => pm.response.json(), 'body is not parseable JSON').to.not.throw();
});
// Files/Download File streams the stored file, so JSON is the wrong contract for it.
// Detected by Content-Disposition rather than by request name, so any future
// download endpoint is covered without adding another exception — and so a regular
// endpoint that started returning a file would still be caught.
const isFileDownload = (pm.response.headers.get('Content-Disposition') || '').includes('attachment');

if (isFileDownload) {
pm.test(`${pm.info.requestName} streams a file body`, function () {
pm.expect(pm.response.responseSize, 'download returned an empty body').to.be.above(0);
pm.expect(pm.response.headers.get('Content-Type') || '', 'download declared no content type').to.not.be.empty;
});
} else {
pm.test(`${pm.info.requestName} returns a JSON body`, function () {
pm.expect(pm.response.headers.get('Content-Type') || '').to.include('json');
pm.expect(() => pm.response.json(), 'body is not parseable JSON').to.not.throw();
});
}

// A 2xx carrying {"error": ...} or {"errors": [...]} is still a failure; the API
// returns that shape for several handled conditions.
Expand Down
Loading