Is there a way to use an external file as either the complete or partial body in a request? #72
-
If this is already a thing, I wasn't able to find documentation on it, so any help is appreciated. If not, can this be turned into a feature request? I think it would be incredibly useful to refer to an external file and use it as the entire or partial request body. Some apis require either large payloads or some just have parts that are repetitive and could be re-used among one or more request bodies. It would be nice to define it in one place and reference it in the request body somehow. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Hey there, thanks for coming up with this. There's indeed missing documentation on this. Should be already possible like this: POST https://httpbin.org/post HTTP/1.1
content-type: application/json
accept: application/json
< ./some.json Does this work for you and suffice? |
Beta Was this translation helpful? Give feedback.
-
@nerdo, does this work for you? |
Beta Was this translation helpful? Give feedback.
-
I will try this today. Is it possible to do partial json? i guess i'll try
that to but wondering what an example of that syntax might be.
…On Fri, Jul 26, 2024 at 4:42 AM Marco Kellershoff ***@***.***> wrote:
@nerdo <https://github.com/nerdo>, does this work for you?
—
Reply to this email directly, view it on GitHub
<#72 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH32TTJFDN2DQYEWTHP7ZDZOIDZFAVCNFSM6AAAAABLNFJFT6VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTAMJVG42TAOI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
|
Beta Was this translation helpful? Give feedback.
-
Ok, so I just tried it with a partial payload and it did not seem to work. Here's what I tried. This is a real-world example using the sendgrid api where I would like to test sending to different recipients using variables, and want the template data to be pulled in from json so that I can easily test different templates that require different data without too much fuss.
BTW I tested this inline (i.e. without the On that note, it is great that we're able to see the response headers with this plugin but it would also be helpful to view the full request that goes over the wire (or even just the curl command that ran it or something of that nature) to help debug some of the more dynamic aspects of the request building. I suspect that the |
Beta Was this translation helpful? Give feedback.
This
<
at the start of the line conforms to the http file spec afaik. But it's not very readable in this case.I might add another metadata field for that, something like
# @file-to-env name_of_env ./filename.json
Which then could be used as a normal env
{{name_of_env}}
..Not yet implemented, but might work quite well.