Matters needing attention in the simulation package

I have made countless crawlers, which may be relatively simple websites. Today I found the problem with a test data of java.
Insert picture description here

This is the route I wrote myself.
The meaning here is to get all the data passed by the front end and return it with json (why not return directly?, I slapped it up, of course, to perform some invisible operations... (I am wrapping a json for myself See it))
Then I used jquery's Ajax test successfully Insert picture description here
, and then I used restclient to test the
Insert picture description here
return result is {}; what? ? ? ? What's the problem?
After hard work, I found the problem. The restclent post uses
content-type: text/json;charset=UTF-8
by default, and I found that I was using x-www-form-urlencoded through the browser capture

Finally, I changed the data in json format to form xx=xx&xxx=xx and modified the content-type: x-www-form-urlencoded; charset=UTF-8

The data was returned successfully.
So how to determine which type of server is used?
When capturing the package, you can see that you can directly look at request heards,
or you can also see what type of data is submitted, such as Google
(small posture: get uses form data by default, which is application/x-www-form-urlencoded)
application/ x-www-form-urlencoded This submission will be from data
text/plain in the future ; application/json is the request payload. When submitting, it needs to be submitted in json format. If it is a java background, the parameters may not be obtained.

Guess you like

Origin blog.csdn.net/qq_35189120/article/details/83180846