alexandrehtrb / Pororoca

An HTTP inspection tool with support for HTTP/2 and HTTP/3. Alternative to Postman.

Home Page:https://pororoca.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple functions for JSON response captures

alexandrehtrb opened this issue · comments

We can add some functions for JSON response captures, like:

  • $.somearray.count() --> counts the number of elements in an array
  • $.somearray.first() --> gets the first element of an array
  • $.somearray.last() --> gets the last element of an array
  • $.somearray.firstWhere(prop == "abc") --> gets the first object whose property prop equals to "abc"
[
  {
    "id": 1,
    "name": "ghi"
  },
  {
    "id": 2,
    "name": "abc" // this one
  }
  {
    "id": 3,
    "name": "def"
  }
]

File to be changed: PororocaResponseValueCapturer.cs + unit tests

Hi @alexandrehtrb
I really like what you have created here and I would be happy to work on this issue.
I've submitted this PR for the first function to get some early feedback and to make sure I am on the right path and I will continue with the rest if you are happy with that.
#87

Hello @cameronpyne-smith ,
Welcome and thanks for your contribution!
You are on the right path, keep going!