Skip to content

Commit

Permalink
Add JSON body length assertion to API check
Browse files Browse the repository at this point in the history
  • Loading branch information
schobele committed Nov 29, 2024
1 parent 7c504a8 commit 007070d
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions __checks__/api.check.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import { ApiCheck, AssertionBuilder } from 'checkly/constructs'


new ApiCheck('get-books-api-check', {
name: 'GET /books',
degradedResponseTime: 10000,
maxResponseTime: 20000,
request: {
url: 'https://danube-store-srebot-test-3a4a0227b89f.herokuapp.com/api/books',
method: 'GET',
headers: [
{
key: 'Accept',
value: 'application/json'
}
],
followRedirects: true,
skipSSL: false,
assertions: [
AssertionBuilder.statusCode().equals(200),
],
}
})
import { ApiCheck, AssertionBuilder } from "checkly/constructs";

new ApiCheck("get-books-api-check", {
name: "GET /books",
degradedResponseTime: 10000,
maxResponseTime: 20000,
request: {
url: "https://danube-store-srebot-test-3a4a0227b89f.herokuapp.com/api/books",
method: "GET",
headers: [
{
key: "Accept",
value: "application/json",
},
],
followRedirects: true,
skipSSL: false,
assertions: [
AssertionBuilder.statusCode().equals(200),
AssertionBuilder.jsonBody("$.length").greaterThan(0),
],
},
});

0 comments on commit 007070d

Please sign in to comment.