Would insomnia plugin support to modify or replace request/response body?
It seems that only reponse buffer is exposed which only porivided to be modified now.
First of all, nice work on discovering the features of the undocumented plugin APIs 馃槃
The first version of the plugin system is meant to be very basic, implementing only the functionality that is unlikely to change down the road. The reason I have not yet added support for modifying request/response bodies is that it's a fairly complicated behavior, which has the potential to be confusing to the end user. Also, I couldn't think of many use-cases for wanting to do those things.
It would be awesome if you could provide some sample use cases for wanting each of those behaviors.
How about send a request against server which accepted a computed/wrapped param and respond a wrapped response, like encryption or something else. 馃槉
When i create the request, i prefer to fill params with original param
Hi, I am not sure if this is the place or I have to start a new issue, I think it is the same feature I am looking for, at least for the first part. My use case is the following, I am trying to create a plugin for using a custom authentication method with adds a header into the request and the value of that header is a hash that includes the path of the request and method. Thanks, I love Insomnia so far and would be happy to help with this.
I'm in the same boat as @migh; authentication method that requires a signed body (amongst a ton of other items).
context.request.getMethod() and context.request.getUrl() are a great start! .getBody() would be perfect for completeness :-)
I also just tried to write a plugin that does HMAC signing.
But without being able to read the body, that's impossible :/
The good news is that we're close to be able to doing this now that multipart for bodies are generated in-house (instead of handed off to curl) . There's just a bit of refactoring left until body can be passed to plugins.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I would agree with everyone else, having the body exposed to plugins would be immensely helpful in the case of HMAC signing the body of the request.
@Jeb135 @janv take a look at https://github.com/sujrd/insomnia-plugin-hmac-auth
looks like plugin system is almost available for this feature, like request.getBodyText, request. setBodyText, response.getBody, response.getBodyStream api, but IMO not enough. e.g. requests with form put body in renderedRequest.body.params (which is confused with request.getParameters, i've not look it closely). And for response, we can only read it rather than replace/edit it, maybe a new response callback is necessary. here is a demo, may be not implemented properly, but it works.
Hey @yittg. Yes, reading of request body is not yet complete. It will not work for form data or file uploads.
I'll take a look today and see if I can get these implemented. Thanks for the demo code.
@gschier any news? I'm currently using small C# app just to test requests with HMAC.
I'd like to migrate to Insomnia, but I need to access form data.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@gschier any updates? HMAC support would be an awesome addition
No updates on this yet. It should remain open though
@gschier any updates?
Most helpful comment
I'm in the same boat as @migh; authentication method that requires a signed body (amongst a ton of other items).
context.request.getMethod()andcontext.request.getUrl()are a great start!.getBody()would be perfect for completeness :-)