'adding @@@@ (AT symbols) to my url sometimes works as expected and sometimes does not
We have a lambda function that has been set up to verify that what we're passing in the url is a valid CUID.
@@@@ is not a valid CUID and we have set it up to respond as a 400 with the error message stating that is is not a valid CUID. This works most the time.
I am using combination superagent, cucumber-tsflow and chai to send http requests and assert the response.
Occasionally i get issues with @@@@ in our url.
Example url: https://ourcompany.com/v1/id/@@@@/accounts'
In cucumber i am occasionally seeing the following:
.Request {
_events: [Object: null prototype] {
end: [Function: bound onceWrapper] { listener: [Function: bound ] }
},
_eventsCount: 1,
_maxListeners: undefined,
_enableHttp2: false,
_agent: false,
_formData: null,
method: 'GET',
url: 'https://ourcompany.com/v1/id/@@@@/accounts',
_header: {},
header: {},
writable: true,
_redirects: 0,
_maxRedirects: 5,
cookies: '',
qs: {},
_query: [],
qsRaw: [],
_redirectList: [],
_streamRequest: false,
[Symbol(kCapture)]: false
}
And the error from the attempt to send the request.
Then I will receive a 400 HTTP response # node_modules\cucumber-tsflow\src\binding-decorator.ts:216
TypeError: Cannot read properties of undefined (reading 'statusCode')
I am making the assumption that the request has failed to send. I do not see it hitting our lambda in the logs. Is there any reason why using @@@@ inside the url might sometimes cause issues for superagent library but not all the time?
I have similar tests where I use !@!@! instead og @@@@ and it never has issues.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
