当前位置:网站首页>[theory] - interface test
[theory] - interface test
2022-06-21 17:02:00 【Expert of explosive liver fist】
One 、 Interface concept
An interface that provides data services for a system .
features :1. The interface can run directly without the existence of the interface
2. The content sent by the front end is called a request (request), Transmission via a specific channel , Send to the back-end server , The server performs computation and processing , Generate response results (response) And return to the front end
3. All interfaces are activated based on requests , And there must be a response
Two 、 signal communication
1.URL: Uniform resource locator , Commonly known as the website . Used to locate the specified path
example :http://127.0.0.1:5000/api/login?args1=xx&args2=aa
http://: Network protocol
127.0.0.1:5000: These are the server address and port ,http The default port number is 80,https The default port number is 443
api/login/: Path of interface
args1 and args2: Is the parameter that is passed when the request is sent to the interface , Use... Between multiple parameters & Compliant connection
2.URI: Uniform resource identifiers
3. Network protocol
HTTP: yes tcp A network protocol over the protocol , If carrying SSL agreement ( certificate ) On the basis of , To form HTTPS Network protocol .
be-all http All requests under the protocol are stateless ( That is, each is an independent individual ), So we need to use cookies、session、token To ensure that the status is continuous .
cookie:
cookie It is a short piece of text information generated in the server and stored in the client , The format is a dictionary ( Key value pair ).
classification : Session level : Save in memory , It will be lost when the browser closes
Persistence : Save on hard disk , Only when the expiration time is up will it be cleared
Authentication principle : When the client first accesses the server , Then the server will generate cookie, Then, by responding to the header set-cookie It is transmitted to the client , Client from 2~n These will be automatically brought with each request cookie.
shortcoming :cookie Save on client , For sensitive information, such as passwords, it will not be secure .
Session
session It is a temporary session saved on the server , All communications are based on the created session To communicate , Have timeliness , Expire over time or actively destroy , be session disappear .
Authentication principle : When the user first accesses the server , Then save a file on the server side sessionid( Encrypted ), adopt cookie Put this sessionid Save to client , Only send when requesting the server sessionid.
Token
token It is usually saved in the request header header perhaps body in , Is in the form of an identity token , It can be obtained by capturing packets .
classification :
access_token: There is a time limit , Restriction on 15 minute
refresh_token: The general limit is 15 God
cookie,session,token The similarities and differences of ?
The same thing : Are used for authentication , Are generated by the server
difference :
1.cookie Store on client ,session Stored on the server ,session The safety ratio of cookie high , So generally, put important information into session, Put the unimportant things cookie.
2.session Server memory present ,token Exist in the server's file or database ,token The advantage is that session Save server resources .
4. Request method (method)
get: Used for query 、 Get the data list
post: It is used to change and submit data
difference :
1)get The method is to pass all data in clear text ( That is, the data can be url Visual display in ), and post The method is to trade various data in secret ( That is, data flows in the body )
2)get The performance of the method is better , Efficient than post Faster , but get Methods store a limited number of parameters . and post It's safer , But it needs to be compressed , Will increase its load , Efficiency slows down .
5. Request content
Header: Define the normalization of the transmitted data content
Body: It is used to store all data transmitted to the interface
Dobbo: It's a distributed microservice framework , Committed to providing high performance and transparency RPC Remote service invocation scenarios
RPC: Remote procedure call
restful: be based on http Interface communication under network protocol , Is a standardized format .
边栏推荐
- Ares阿瑞斯i质押LP挖矿众筹模式dapp智能合约定制
- 关于印发《北京市共有产权住房管理暂行办法》的通知
- d改进翻译
- Why do you want to develop tea mall applet app?
- 深入理解零拷贝技术
- 2022年Q1手机银行用户规模达6.5亿,加强ESG个人金融产品创新
- Introduction to mqtt protocol
- Publicity of the first batch of shortlisted enterprises! Annual Top100 smart network supplier selection
- AutoK3s v0.5.0 发布 延续简约和友好
- qtcreator报错解决
猜你喜欢

【观察】微软“云+端”全面创新,让混合云更简单、更灵活、更安全

Google Play Academy 组队 PK 赛,正式开赛!

Pytest框架

海外new things | 美国人工智能初创「Zoovu」新一轮融资1.69亿美元,为消费者优化线上的“产品发现”体验

About SQL: does anyone in SQL know how to answer these questions?

Huawei cloud releases desktop ide codearts

如何编写测试用例

HUAWEI(13)——路由引入

Deep understanding of zero copy technology

Cisco (35) -- BGP introduction experiment
随机推荐
AutoK3s v0.5.0 发布 延续简约和友好
Deep understanding of zero copy technology
Huawei cloud releases desktop ide codearts
string类的模拟实现
Serious illness insurance covers serious illness. Which product is the best in the market? Please recommend it
微信小程序开发入门教程-文本组件介绍
KindEditor上传图片及使用
The release of autok3s v0.5.0 continues to be simple and friendly
Advanced performance test series 5. server development, VMware virtual technology
Overseas new things | software developer "dynaboard" seed round raised US $6.6 million to develop low code platform to connect design, products and developers
【1108. IP 地址無效化】
Advanced performance test series 2. software performance test, load test and stress test
Disruptor本地线程队列_WorkProcessor异常_FatalExceptionHandler---线程间通信工作笔记004
Pingcap was selected as the "voice of customers" of Gartner cloud database in 2022, and won the highest score of "outstanding performer"
Google Earth Engine(GEE)——sentinel-1综合查看两个月前后自动滑坡监测,两者之间的差异(危地马拉为例)
Any to Any 实时变声的实现与落地丨RTC Dev Meetup
Ares Ares I pledged LP mining crowdfunding model DAPP smart contract customization
Yaml文件详解
Advanced performance test series 3. performance index, reliability test, capacity test and performance test
MQTT协议介绍