N
N
Nadim Zakirov2022-01-19 06:07:59
AJAX
Nadim Zakirov, 2022-01-19 06:07:59

What can you use your own request type/method for?

I learned a funny thing today, it turns out JavaScript allows you to send requests with ANY method:

response = await (await fetch('/', { method: 'MYMETHOD' })).text();

Accordingly, nothing prevents you from coming up with your own request methods and using them everywhere. The only question here is benefit. What could it possibly be used for? Bot protection? As an option, but somehow weakly. Maybe there are more interesting applications?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alekssamos, 2022-01-19
@alekssamos

Not for what, just like that.
You might as well write your own HTTP header: x-qwerty: asd. And nothing will happen.

V
VegasChickiChicki, 2022-01-19
@VegasChickiChicki

Sergey delphinpro 's answer to this question, I think you can create your own endpoints in the API for some specific things.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question