当前位置:网站首页>From client to server
From client to server
2022-06-24 23:18:00 【13 less】
When we send a request , From client to server , What have you experienced ?
One . Considerations for invoking interfaces
Our focus is on the requested address , Requested method ,tokne, Request header , Requested parameters , Request type , These things can be seen in the console . When our request fails , Don't rush to the back end , First determine whether the address of your request is correct , The requested method is incorrect , And the transfer of parameters , When there is no problem, the data is still unavailable , We can ask questions before it's too late , Always keep the interface document handy for easy viewing .
(1) See the position of parameters

(2) Where the response data is
Both of them can see the returned data
(3) The requested method and address

(4) Request header
It's storing token And some information that contains the request

Two .x-www-form-urlencoded and form-data and raw The difference between
Position of being :
3、 ... and . Status code returned by the server
Usually, the front-end call is accompanied by the back-end status code , To determine whether the data has been returned successfully , And whether the operation was successful .
Common status codes :
2xx Return to success Or the operation is successful
3xx Represents the redirection problem
4xx Parameter error weight insufficient Parameter error
5xx The server crashed
(1) I have talked about Dang in previous articles token When it fails, the user does not have permission to access it ,token When it fails
Status code from 2xx become 4xx Insufficient authority , You can do something at this time token Treatment of failure . The status code is not fixed, but can be set by the backend
(2) When to return to 2xx When
It indicates that the request or operation is successful . Interface call successful .
边栏推荐
猜你喜欢

The extra points and sharp tools are worthy of the trust | know that Chuangyu won the letter of thanks from the defense side of the attack and defense drill!

Super detailed cookie addition, deletion, modification and query

【js】-【树】-学习笔记

RT-thread使用rt-kprintf
15 lines of code using mathematical formulas in wangeditor V5

Ganglia 的安装与部署
How should we measure agile R & D projects?

从客户端到服务器

Record the range of data that MySQL update will lock

Simulated 100 questions and online simulated examination of high voltage electrician examination in 2022
随机推荐
The extra points and sharp tools are worthy of the trust | know that Chuangyu won the letter of thanks from the defense side of the attack and defense drill!
go Cobra命令行工具入门
Selection (029) - what is the output of the following code?
数字IC设计经验整理(二)
jar中没有主清单属性
gocolly-手册
Attention, postgraduate candidates! They are the easiest scams to get caught during the preparation period?!
SimpleDateFormat 格式化和解析日期的具体类
Second IPO of Huafang group: grown up in Zanthoxylum bungeanum, trapped in Zanthoxylum bungeanum
记录一下MySql update会锁定哪些范围的数据
laravel 宝塔安全配置
23研考生注意啦!备考期间最容易中招的骗局,居然是它们?!
Tech Talk 活动回顾|云原生 DevOps 的 Kubernetes 技巧
UNION ALL UNION FULL JOIN
Financial management [3]
laravel model 注意事项
Pousser l'information au format markdown vers le robot nail
laravel 验证器的使用
监听 Markdown 文件并热更新 Next.js 页面
RT-thread使用rt-kprintf

