-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display a warning when using http.get
and http.head
with more than 2 arguments
#2823
Comments
@oleiade Why not directly an error? |
I meant warning as in "a step that, conceptually, warns the user". In practice, an error would do 😉 |
Hi does this issue still make sense? I'd like to work on it if possible |
Hi @juliaokmenezes, yes, it still makes sense. Feel free to open a new PR for it or ask for details if something is not clear. |
Hi @codebien, i will try it! Could you please provide, if possible, indications where in the project the HTTP validations are treated, there are any guideline to run the project? |
Hey @juliaokmenezes, You can find the Lines 71 to 82 in 001aff5
It sounds like a viable way to define a small validation function for the logic required for this issue and then call it from those methods before invoking the |
Brief summary
The current prototype of the
http.get
andhttp.head
methods can prove to be somewhat error-prone, as they take only two arguments, whereas the other HTTP verb-related methods do take 3.Although not a bug per-se, this UX can lead to confusion in scenarios like the one I ran into recently: trying to set headers on an HTTP request. Following the docs examples, I intuitively wrote
http.get('myurl', null, params)
withparams
containing my headers. But thehttp.get
method would ignore my params completely, as it would treat the second parameter asnull
params instead of anull
body.k6 version
v0.40.0
OS
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Expected behaviour
It's been discussed internally that to let the user know that this is a misuse of the
http.get
andhttp.head
methods, we should emit a warning. Something indicating to the user that they're probably doing something wrong: "beware: the http.get and http.head methods do not take a payload argument" or something along those lines would probably do.Actual behaviour
⚔️
The text was updated successfully, but these errors were encountered: