Is there a way to poke potentially GBs of data in to a json field?

My question:
Is there a way to generate and put a large amount of data (can be random) in to a json field value?

Details:

I need to test one of our endpoints that creates a document on the server using the given values of the request body.

The body of the request is this:

{
    "kind" : "document",
    "name" : "Document.txt",
    "content_type" : "text/plain",
    "content_encoding" : "ascii",
    "content" : "{{content}}"
}

My current pre-request Script that creates the variable content looks like this:

pm.variables.set("content", 'x'.repeat(10*1024*1024))

That currently allows the api to create a text document that is 10mb in size.

The problem is that the upper file size limit to test is 4GB!

I can’t just increase the value being pumped in to the content variable because of size limit on the variable.

So is there another way I can ideally generate up to 4GB of data on the fly and get it in to my json field or are there other approaches I could look at?

Any help thoughts appreciated :slight_smile:

Me with my developer or DevOps hat on when somebody wants to test a 4GB file upload:

ssp

Me with my tester’s hat on:

If all that you want to do is verify that the upper file size limit is being enforced, can you reconfigure the server so that the max file size is temporarily much smaller (e.g. reduce it to your suggested example for 10Mb)? Once you’ve tested the upper bounds, then you can just change your max_file_size value (and verify that the code change was correct) and have confidence that the code still enforces the size limit.

Hi @neilstudd, thanks for the reply.

Yes, that is normally how I would test the configured upper filesize limit, but due to some new code having gone in which actually “fixes” an issue whereby a very large upload would crash the server, the new upper limit is 4gb which I should really test.

I can of course switch this test to handling it in code instead of postman, but if it is possible in Postman, I would love to know how.