-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
🧹 [Maintenance]: Add a straightforward approach for accessing response headers in *fiber.Agent #3184
Comments
Thanks for opening your first issue here! 🎉 Be sure to follow the issue template! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord |
@efectn Maybe for v3 we should make the functions have the same naming convention as net/http? |
Hey, so you want to implement this from scratch or just implement new functions that does the same thing that you've mentioned (in current situation section) under the hood. |
@TusharMohapatra07 We already have this functionality in On the other hand, it might be worth revisiting the names of the functions for the |
Yes we can do it for better naming convention |
As this was one of the results I stumbled on when searching for this, I just wanted to add my solution for accessing response headers using agent := fiber.Get("https://example.com")
// Acquire a response object to store the result
resp := fiber.AcquireResponse()
agent.SetResponse(resp)
statusCode, body, errs := agent.Bytes()
location := resp.Header.Peek(fiber.HeaderLocation)
fmt.Println("Location: ", string(location)) |
Maintenance Task Description
Hello, Fiber team!
I’d like to propose a feature enhancement for Fiber’s *fiber.Agent. Currently, retrieving response headers requires extra steps that feel more complex than necessary, especially when compared to Go’s standard net/http package.
Current Situation
To access response headers, we need to manually set up the request and then access headers from the Response() object by iterating over them, which can be cumbersome. For example:
Proposed Solution
Could we add a more direct and intuitive method to access response headers directly from *fiber.Agent? For example:
Benefits
Thank you for considering this feature! It would make working with *fiber.Agent more intuitive and developer-friendly.
Impact on the Project
No response
Additional Context (optional)
No response
Checklist:
The text was updated successfully, but these errors were encountered: