GithubHelp home page GithubHelp logo

Comments (4)

jreyesr avatar jreyesr commented on August 20, 2024 3

Hello! Just to wrap this up, v1.4.0 was released yesterday. It includes a way to read output data from response headers, the status code, and the request time, in addition to the response body.

image

You should be able to update the plugin from Insomnia Preferences>Plugins (I hope, I haven't seen a button to do so). Worst case, you could uninstall and reinstall the plugin.

Feel free to try this out, and report any issues that you encounter. Otherwise, thanks for using the plugin and raising this issue!

from insomnia-plugin-batch-requests.

jreyesr avatar jreyesr commented on August 20, 2024 1

Hello @jochettino, and thanks a lot for the kind words!

I recall that being mentioned (briefly) on #3 (comment), a long time ago, but that conversation ultimately went another way and I never added that functionality.

Currently, the JSONPath expressions that can be used to save data from the response back to the CSV will always target the response body (i.e. the $ is always the response body, which must be JSON). I'm envisioning something like this: we add a dropdown menu to each Output, which lets you select from where will that data be pulled. For example, the response headers are another possible source of data on a response, apart from the body. And there's also the HTTP status code, which isn't a header, which is what you need. All those are different "data sources". Here's a quick idea that doesn't do anything yet:

image

Notice how there's a dropdown on the middle of each output. By default (i.e. on every newly added Output), it would be set to "From body", which is what it does now. On that state, the $.data.fullName expression would read from the JSON response. However, on the second output, the dropdown is set to "From header", and in that state the X-Entity-ID expression would read from a HTTP header like X-Entity-ID: 123.

Finally, what you asked for is at the bottom: the dropdown is set to "Status code". Notice how on that one we hide the JSONPath text field, since the status code is just the status code, there's no need to select anything from it.


Does that sound like it would solve your need? Or is it too complex? In such case, how did you imagine extracting the status code? In other words, what would you expect to write on the JSONPath field, so that it it returns the status code? As things are now, just writing $.statusCode would not work, since that would expect the response to be something like {"statusCode": 123}. I toyed with the idea of force adding a "magical" property to $, so something like $.__insomnia_status_code would automagically return the status code, but it feels a bit too obscure to me. The dropdowns are much more explicit, as just their existence encourages you to click on them and discover that there are other alternatives to retrieve data from. I'm curious as to other ways/UIs to expose data that isn't in the response body.

from insomnia-plugin-batch-requests.

jochettino avatar jochettino commented on August 20, 2024 1

I tried it out this morning as I saw the change has been merged and a new version was generated. I celebrated with the team. The status code feature works like a charm.

Muchas gracias, amigo!

from insomnia-plugin-batch-requests.

jochettino avatar jochettino commented on August 20, 2024

Wow! Thanks for your quick answer.

I like your UI approach. Initially, I thought about having a "magical" property as you mentioned, but your proposal looks nice. Moreover, it adds the capability to extract the header response which I'm sure will be useful for others.

I can say your mock UI is easy to understand and doesn't overengineer the solution.

Regards!

from insomnia-plugin-batch-requests.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.