Add a ParamOptional method #99
-
Hello, First and foremost, I want to express my thanks to you for creating this library. I really enjoy using it! My favourite part of this library is its fluent API. However, there is a scenario that requires me to create intermediary steps, and that is when I'm calling an API that has optional query parameters. In that case, I have to break the chaining and do empty string/nil checks to not accidentally add empty strings to the query param. I've also experienced some APIs that don't handle those very well. Therefore, I have a suggestion that I think could improve the DX for these types of situations: the introduction of a This method would allow the addition of query parameters which, if their value is an empty string, would be automatically filtered out. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Yes, I've wanted this for headers too where it would set the header but only if it's not already set. I'm not totally sure how it should work or how to make it maximum simple and flexible, but it's something I want to do if we can get a good design for it. |
Beta Was this translation helpful? Give feedback.
Fixed the names. Needs an adjustment to the big doc string, but it's close.