Skip to main content

API Check with binary request body

I would like to run the equivalent of

$ curl --data-binary @body.bin --output response.bin --header "Content-Type: application/ocsp-request"

I have looked at using a setup script:

But that gives this error:

I’m not interested in the precise contents of the response body, as long as has a 200 response code.

Status: Completed8 comments

Log in to comment and vote

Comments8

  • Daniel Paulus

    Team•

    Feb 7, 2024

    You can do this with our new Multistep checks alredy.

    See my example for querying my personal Clickhouse instance here:

    async function queryClickhouse(query, request) {
      const buff = Buffer.from(query, "utf-8")
      const response = await request.post(`${baseUrl}`, {
        headers: {
          "X-ClickHouse-User": "",
          "X-ClickHouse-Key": process.env.ch_pass,
        },
        data: buff,
      })
    
      const buf = await response.body()
      expect(response.ok()).toBeTruthy()
      const res = new String(buf).toString()
    
      return res.split('\n')
    }
    
    
    test("check clickhouse", async ({ request }) => {
    
    
      await test.step("check clickhouse version", async () => {
        const response = await queryClickhouse("SELECT version()", request)
        console.log(response)
      })
    })
  • Tim Nolet

    •

    Nov 28, 2023

    Hi all, we just released Multistep API checks into Beta. This enables using binary response bodies in pretty much any way or shape.

    We've updated our docs on how to achieve this 👇

    https://www.checklyhq.com/docs/multistep-checks/upload-downloads-filesystem/

  • Tim Nolet

    •

    Oct 13, 2023

    We have earmarked this item to start working on soon!

  • Tim Nolet

    •

    Aug 22, 2023

    I'm merging this roadmap item to https://checkly.featurebase.app/submissions/64dd377f8b15fc2614a182b6 as it has a bit more context.

  • ri4a

    •

    Aug 22, 2023

    Use case: OCSP is used to check for certificate revocation. We transport documents via AS4 and have to ensure the receiver certificate has not be revoked. However, the OCSP responder is flaky (periods of timeouts). We need data to show this.

  • Tim Nolet

    •

    Aug 22, 2023

    Hi, thanks for mentioning this. Can you give me a bit of background what use case you are trying to test with the OCSP request?

  • Tim Nolet

    •

    Jun 19, 2023

    Thanks for reporting James, can you give me an idea of the typical body size you are expecting to return from your API calls?

    • James Hartig

      •

      Jun 20, 2023

      Nothing more than 10kb. I think mostly only a few kilobytes.