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

[FEATURE REQUEST] Improved POSTs requests (1): automatic Content-type #1117

Open
JulianGR opened this issue Apr 3, 2024 · 1 comment
Open
Labels
enhancement New feature or request pinned

Comments

@JulianGR
Copy link
Contributor

JulianGR commented Apr 3, 2024

Hello, I'd like to discuss 2 enhancements. I've written them separated, so its easier to track. The other one is #1118


FEATURE REQUEST 1: automatic Content-Type

Is your feature request related to a problem? Please describe.

When using the --data flag, one must also specify the Content-Type header in the config file.

Describe the solution you'd like

When using x-www-form-urlencoded, such as with

-m POST --data 'grant_type=password&username=admin&password=aaa'

it could be nice if the tool automatically detects the encoding, and adds a header like: Content-Type: application/x-www-form-urlencoded

As another example, when using json such as with

-m POST --data '{
  "grant_type": "password",
  "username": "admin",
  "password": "aaaa"
}'

it could be nice if the tool automatically detects the encoding, and adds a header like: Content-Type: application/json

Describe alternatives you've considered

I know this feature could be hard to implement, but I believe It can be simple. Basically with

  • Content-Type: application/x-www-form-urlencoded
  • Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryXXX
  • Content-Type: application/json

you have 99% of body encodings covered.

Additional context
N/A

@epi052
Copy link
Owner

epi052 commented Apr 15, 2024

howdy, and thanks for submitting these requests!

i took a brief look to see if guessing content-type was provided by one the libraries already in use within ferox. Unfortunately, that functionality isn't present. I didn't immediately see any other premade options either. Pinning this for now, as it's a nice quality of life improvement, but it's a heavier lift than i'm able to do at the moment.

@epi052 epi052 added the pinned label Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned
Projects
None yet
Development

No branches or pull requests

2 participants