Skip to content
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

feat: add user-agent to headers #133

Conversation

kobenguyent
Copy link
Collaborator

@kobenguyent kobenguyent commented May 6, 2024

if user doesn't specify the user-agent header, restfox would add it to the request to help the server identify Restfox as the HTTP requesting application or client.

Screenshot 2024-05-07 at 10 39 24

Copy link

netlify bot commented May 6, 2024

Deploy Preview for chimerical-kitsune-a0bfa0 ready!

Name Link
🔨 Latest commit 86c64da
🔍 Latest deploy log https://app.netlify.com/sites/chimerical-kitsune-a0bfa0/deploys/6639e759884dfb00087c787b
😎 Deploy Preview https://deploy-preview-133--chimerical-kitsune-a0bfa0.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@flawiddsouza
Copy link
Owner

Hi. Thanks for the PR. However there are some issues.

  1. This will hardcode the user agent to Restfox + version that the user is using at the time of creating the request.
  2. We are adding header data that is non essential to the user into user's data (only required for IDing the client)
  3. Right click request -> Copy to CURL now includes the user agent in it, which is not desirable for the user

To rectify this, we can do this:

  • We will show the default headers above the usual headers in a table. These headers (currently only one) will be unmodifiable (can't uncheck, can't delete) [similar to how its done in other popular http clients]
  • We will have a small note below the default headers table saying "These headers can be overriden below if required."
  • The default header will be dynamic and will always send the actual version of restfox that is currently in use - this should be implemented in handleRequest method in the helpers.ts file + we should not add the default header User-Agent if user has an enabled header that is User-Agent.

@flawiddsouza
Copy link
Owner

On second thought, maybe we don't need to show the default headers in the headers section. Just adding them directly to the request when sending it should be enough. Just implementing the 3rd point should be good enough.

@kobenguyent
Copy link
Collaborator Author

@flawiddsouza thanks for your review! Addressed as your proposal!

@flawiddsouza flawiddsouza merged commit d3baaa5 into flawiddsouza:main May 7, 2024
6 checks passed
@kobenguyent kobenguyent deleted the feat/add-default-user-agent-to-headers branch May 7, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants