-
Notifications
You must be signed in to change notification settings - Fork 50
TypeError: Object has no member ‘replace’ #42
Comments
i'm having the same problem, its this makeRequestConfig() in core.js. i could hack it about to work but there has surely got to be a fix to this? |
Hi guys. Thanks for the report. I'll be looking into this soon. |
Does someone have an example collection they can post? My tests are not reproducing. |
Hi guys. Would really like to fix this bug but so far I haven't found an input that causes it. If someone could send a Postman collection that causes it, that would help a lot. I'd be able to find what's happening and publish a fix. @marcelo-dalmeida @Lex-talionis |
Hi @bookmoons Sorry for the delay. It is basically a ms/word file upload (binary file upload handling) Here is the collection I was using it: |
Thanks a lot @marcelo-dalmeida. Will investigate. |
This is the conversion I see. The Is this also what you see? Is it possible you were adding that data: { user_id: "5", file: "" }, postman[Request]({
name: "/recommendation (file upload)",
id: "05cc76cd-214f-46b7-a251-5219b509eab1",
method: "POST",
address: "{{recommendation-url}}/recommendation?start=1&limit=10",
data: { user_id: "5", file: "" },
headers: {
"Content-Type": "application/json"
},
post(response) {
var recommendation_url = postman.getEnvironmentVariable(
"recommendation-url"
);
if (
recommendation_url.startsWith("{{") &&
recommendation_url.endsWith("}}")
) {
var url_variable = recommendation_url;
url_variable = url_variable.replace("{{", "");
url_variable = url_variable.replace("}}", "");
new_recommendation_url = postman.getEnvironmentVariable(url_variable);
postman.setEnvironmentVariable(
"recommendation-url",
new_recommendation_url
);
}
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable(
"recommendation_request.id",
jsonData.recommendation_request.id
);
}
}); |
I'm not with a computer right now to further check if I got the same and exactly what I did after, but you are right. I remember now that it didn't work by purely converting it, so I tried to fill the blanks manually. And then I found this error. So it is probably two separate bugs. |
OK thanks a lot for your help. Going to build a fix. |
As mentioned in:
https://community.k6.io/t/typeerror-object-has-no-member-replace/253
"Hi
I’ve just converted a postman collection through postman-to-k6 tool.
I’m having the current problem when executing the script and it seems to be connected to http.file part
I’m out of clues about what is happening here
code:
Error raised while running the script:
Thank you in advance"
P.S. It is uploading a word document (binary)
The text was updated successfully, but these errors were encountered: