question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expand RequestMethods optional arguments

See original GitHub issue

I’ve come across at least one example of an API where I need to both POST a body of some form and also have query parameters on a request, and this is something I’m accommodated so far in my beekeeper project - largely because I’ve been handling setting those items up in my own code.

I’m now migrating that to urllib3, and one snag I’m seeing is that RequestMethods.request() takes a single fields argument that turns into either a querystring or x-www-urlencoded depending on method- as far as I can tell, there’s no way to choose to pass either one or the other explicitly.

Would there be any objection to expanding the request() signature to enable those items to be passed explicitly? The way I’m conceiving of it, fields would still be encoded according to the request method, while the type-specific arguments (params and form? Dunno - suggestions welcome) would always be added to the request in their specified format.

If this isn’t an appropriate extension, it’s not a big deal - I can keep doing it in my own code.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
haikugingercommented, Jun 9, 2016

New structure should be much easier to test for stuff like this; I’m having .request() request modified headers/URL/body from a couple encoding methods rather than having those methods inline with the HTTP pipeline.

I’ll also submit a patch and PR for that separately so it’s fixed in the meantime.

0reactions
shazowcommented, Jun 9, 2016

Huh right you are, that looks like a bug, and we need a test! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do i extend a constructor+method with optional ...
I want to override both the constructor and the start() / stop() methods, but i don't know how to do that in the...
Read more >
Optional Function Parameters With Default Values Via ...
We'll take a look at how we can use objects and the spread operator to provide good default values while still allowing for...
Read more >
Dealing with Optional Parameters in Go | by Peter Malina
The simplest solution for dealing with a small number of variables is to use different functions. This technique uses WithX as a convention...
Read more >
How do I pass an expanded optional argument using expl3 ...
The short answer is that there is no mechanism to do that, because we try to promote separating user interface (through xparse, ...
Read more >
11. Parameter handling - Exploring JS
It now supports parameter default values, rest parameters (varargs) and destructuring. Additionally, the spread operator helps with function/method/constructor ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found