Skip to content
This repository has been archived by the owner on Apr 20, 2019. It is now read-only.

Fixes bug where #99, where in path parameters of pipelined requests, $n doesn't necessarily have to have a reachable path. This is helpful in cases when the response of a request on which the current request is dependent on, doesn't return a JSON object but just empty strings #100

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

adisingh007
Copy link
Contributor

@adisingh007 adisingh007 commented Sep 16, 2018

Closes #99

Modified the internals.requestRegex.

Now it also matches for a path parameter without any reachable content.

That is, if the payload is:

"requests": [
    { 
        "method": "get",
        "path": "/some/path"
    },
    {
        "method": "get",
        "path": "/another/path/$0"
    }
]

And if the 0th request returns just a string, say, someString,

The path in the 1st request is taken as /another/path/someString

Now the regex has 4 groups:

For example, the URL path is: /some/path/$1.name.firstname/$1.id/$0/something, the matches from (regex101[regex101.com]) is:

Full match: `/some`
p1: N/A
p2: N/A
p3: "some"
  
Full match: `/path`
p1: N/A
p2: N/A
p3: "path"
  
Full match: "/$1.name.firstname"
p1: "1"
p2: "."
p3: "name.firstname"
  
Full match: "/$1.id"
p1: "1"
p2: "."
p3: "id"     
  
Full match: "/$0"
p1: "0"
p2: N/A
p3: ""    
  
Full match: `/something`
p1: N/A
p2: N/A
p3: "something"

@adisingh007 adisingh007 force-pushed the hapi#bassmaster#99 branch 2 times, most recently from 0c941c1 to c9a743d Compare September 16, 2018 15:31
@adisingh007 adisingh007 changed the title Hapi#bassmaster#99 Fixes bug where #99, where in path parameters of pipelined requests, $n doesn't necessarily have to have a reachable path. This is helpful in cases when the response of a request on which the current request is dependent on, doesn't return a JSON object but just empty strings Sep 16, 2018
Copy link
Contributor

@cadecairos cadecairos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, can you rebase it now that the fix in
#98 has been merged?

@adisingh007
Copy link
Contributor Author

adisingh007 commented Sep 17, 2018 via email

…mething where "n" can be any positive integer
@cadecairos cadecairos merged commit 5e3063b into outmoded:master Sep 20, 2018
@adisingh007 adisingh007 deleted the hapi#bassmaster#99 branch September 20, 2018 09:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants