Need your feedback on a new key-value piston input type in webCoRE


#21

Working with @ipaterson to get this into the master. The discussion is around making the value a true JSON string which would require brackets to complete. The colon check could be a problem if not base64 encoded. The code update hack would be again at 3282 as the following looking for the brackets as follows:

Line 3282:

headers: (auth ? ((auth.startsWith('{') && auth.endsWith('}')) ? ( new groovy.json.JsonSlurper().parseText( auth ) ) : [Authorization : auth]) : [:]),

Your piston input value will need to change to have escaped { } as shown here:

\{ "x-api-key" : "{apikey}", "authorization" : "{apikey}", "Public-Key-Pins": "max-age=2592000; pin-sha256=\\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\\";" \}

or simple x-api-key only would be:

\{ "x-api-key" : "{apikey}" \}

It would be great to get a second check on this and the okay your side.


Getting 403 with custom http header X-Api-Key
Getting 403 with custom http header X-Api-Key
#22

Hello @Bloodtick_Jones & @ipaterson . I have re-amended the code at line 3282 and updated my Authoization header Value as per your instructions and can confirm that, for me at least, all is still functioning as intended. I again checked all existing pistons (unnecessarily I’m sure) to confirm that they were unaffected by the update which I can also confirm.
Thanks very much for all of the work you guys are putting in.


#23

I tested local and remote requests and this seems solid. I like the Expression input for json since you can split it into multiple lines:

'\{
    "Header-A": "anteater",
    "Header-B": "bumblebee"
\}'

To properly encode values that may contain a double quote character I’m using the following. The json function is also useful for safely encoding data from a variable. In the Expression input:

'\{
    "x-foo": {json('a"b')}
\}'

#24

I believe I will have time to release this tomorrow morning. The update also includes a fix for some people who were having trouble selecting devices in the app.


#25

Hi!

I must confess that I have an OCD: need to optimize code, otherwise it stays bugging me forever.

The implementation of key-value variable would be a blessing to solve some challenges that I’m facing with my pistons.

I read part of this thread and I’m bit confused … has it been implemented? Seems that it hasn’t. Am I wrong?

Thanks!