python Interface Automation 1-http Protocol Overview

Foreword

Know the interface test of a small partner should be clear http protocol, and if you do not know, so do not interface testing, automation interface even do bad. So before making interface testing to understand the next http:

HTTP protocol (HyperText Transfer Protocol, Hypertext Transfer Protocol) is the most widely used on the Internet A network transport protocol, all WWW documents must comply with this standard. HTTP is used to transfer a data (HTML files, image files, query results, etc.) based on TCP / IP communication protocol. Request and response is based on connectionless mode, stateless application layer protocol.

A request in the request of the composition

1. The request line (request line)

2. Request header (header)

3. blank line

4. The request parameters (body)

 Second, the response also consists of four parts, namely:

1. Status Line

2. message header

3. blank line

4. response body.

Status code consists of three numbers, status codes have a total of five categories:

We are here to clear each number roughly what does it mean, anyway 200,4xx like 200,404,502 or 5xx are common this time I want to know appear 4xx, is that the client's request fails, the server response is a 5xx problem

1xx: indication information - indicates a request has been received, processing continues

2xx: Success - indicates that the request has been successfully received, understood, accepted

3xx: Redirection, no further action needs to complete the request

4xx: Client Error, request contains a syntax error or could not fulfill the request

5xx: Server Error, the server error has occurred during the processing of the request

Third, the conventional way get and post requests

Combine the above two screenshots Summary:

1.get certainly not the request parameter in the body, post there may also be no request parameter;

2.post the body type of data can be viewed in Raw fiddler in the head inside the Content-Type, common is application / json, application / x-www-form-urlencoded;

3.get for acquiring data from the server, post for submitting data to the server;

Some people here say get insecure, post security, in fact, there is no safe insecurity that is because after capture can be seen. If you want to know how to use fiddler packet capture tool, it would look small series of articles on fiddler, thank you! ! !

fiddler packet capture tool interface:

Guess you like

Origin www.cnblogs.com/gsxl/p/11708282.html