cukes icon indicating copy to clipboard operation
cukes copied to clipboard

Query parameters aren't encoded properly

Open githubble01 opened this issue 8 years ago • 2 comments

Hi!

Really like cuke-rest. While writing a test for the JIRA API I think I encountered a bug though...

It seems like the queryParam Type=Shipment AND createdDate>=-1d is encoded "once more" before put in the URL (the % is encoded to %25 and + is encoded to %2B ). Query params: jql=Type%3DShipment+AND+createdDate%3E%3D-1d But Request Url: http://40.68.84.149:8080/rest/api/2/search?jql=Type%253DShipment%2BAND%2BcreatedDate%253E%253D-1d

Se also full log snippet.

test.feature

    Given baseUri from property "jira.base_url"
    And content type is "application/json"
    And queryParam "jql" is "Type=Shipment AND createdDate>=-1d"
    When the client performs GET request on "/search"

cukes.properties

#default - false
cukes.url_encoding_enabled=false
#cukes.relaxed_https=false

Log snippet.

method:	GET
Request params:	<none>
Query params:	jql=Type%3DShipment+AND+createdDate%3E%3D-1d
Form params:	<none>
Path params:	<none>
Multiparts:		<none>
Request URI:	http://40.68.879.149:8080/rest/api/2/search?jql=Type%253DShipment%2BAND%2BcreatedDate%253E%253D-1d
X-AREQUESTID: 911x168628x1
X-ASEN: SEN-8958841
Set-Cookie: atlassian.xsrf.token=B4ZF-PZLU-TF1H-TP28|edfdaca36c2e0ad606d4ffd05c54f7abeda83a4a|lout;path=/
X-AUSERNAME: anonymous
Cache-Control: no-cache, no-store, no-transform
X-Content-Type-Options: nosniff
Content-Encoding: gzip
Vary: User-Agent
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Thu, 18 May 2017 15:11:26 GMT
Connection: close
{
    "errorMessages": [
        "Error in the JQL Query: The character '%' is a reserved JQL character. You must enclose it in a string or use the escape '\%' instead. (line 1, character 5)"
    ],
    "errors": {
        
    }
}
HTTP/1.1 400 

githubble01 avatar May 18 '17 15:05 githubble01

I was able to reproduce the issue only if I have cukes.url_encoding_enabled=true in cukes.properties.

Can you doublecheck that cukes.properties is in the correct place? (Usually it's inside src/test/resources)

sergeytrasko avatar Aug 03 '17 07:08 sergeytrasko

Hi Sergey,

The cukes.properties is in src/test/resources.

Greets, Georg

2017-08-03 9:18 GMT+02:00 Sergey Trasko [email protected]:

I was able to reproduce the issue only if I have cukes.url_encoding_enabled=true in cukes.properties.

Can you doublecheck that cukes.properties is in the correct place? (Usually it's inside src/test/resources)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ctco/cukes/issues/74#issuecomment-319889238, or mute the thread https://github.com/notifications/unsubscribe-auth/ABgPAuBgThLto3k4r8Hwd_VT8aaKeHbyks5sUXRZgaJpZM4NfZkc .

githubble01 avatar Aug 16 '17 07:08 githubble01