A front-end Http request construction method, device, equipment and medium
By obtaining version information and configuration information, the configuration file of the HTTP request is constructed, which solves the problem of complex and inefficient HTTP request construction process, and achieves flexible configuration and efficient development.
Patent Information
- Application Number
- CN202210071444.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-21
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-01-21
AI Technical Summary
The construction process of HTTP requests in the existing technology is complex and inefficient, resulting in low development efficiency. In addition, when parameters are different in different scenarios, a large number of repeated construction requests are required, which increases the probability of errors.
By obtaining version information and configuration information, determining the configuration file, and constructing HTTP requests based on the configuration file, including parameter checking and exception handling, reducing duplicate code and improving development efficiency.
Flexibly constructing HTTP requests through configuration files reduces the probability of parameter exceptions during the request construction process, improves development efficiency, avoids duplication of code, and achieves flexible configuration.
Smart Images

Figure CN114553966B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, equipment and medium for constructing a front-end Http request. Background Art
[0002] HTTP request refers to the request message from the client to the server. It includes: the resource request method, resource identifier and the protocol used in the first line of the message. Many HTTP requests are required during the current software operation, including client-to-server or server-to-server requests. The rapid construction of HTTP requests is an important part of the HTTP request and response process.
[0003] At present, when developers process HTTP requests, they use a lot of middleware such as axios, superagent, and fetchjs to construct HTTP requests, pass parameters, and parse server responses. However, with the development of technology, more and more functions need to be edited in current network applications. Correspondingly, the code logic becomes more and more complicated, and the probability of errors is also increasing. In addition, when the application scenarios of HTTP requests are different and the parameters are different, a lot of work needs to be done to construct requests and process return values. At this time, re-editing the code based on developers is not only inefficient and inconvenient for maintenance, but also greatly affects development efficiency. Summary of the invention
[0004] One or more embodiments of the present specification provide a method for constructing a front-end HTTP request, which is used to solve the following technical problem: how to provide an efficient method for constructing a front-end HTTP request.
[0005] One or more embodiments of this specification adopt the following technical solutions:
[0006] One or more embodiments of this specification provide a method for constructing a front-end HTTP request, the method comprising:
[0007] Get the version information and configuration information of the front-end HTTP request to be generated;
[0008] Determine the configuration file of the front-end HTTP request to be generated according to the version information and the configuration information;
[0009] Determine the calling method of the front-end HTTP request to be generated according to the configuration file;
[0010] If there is an HTTP request initiated by calling the front-end HTTP request to be generated, then in response to the HTTP request being initiated, a front-end HTTP request is constructed according to a preset request event and the configuration file.
[0011] In one or more embodiments of the present specification, in response to the initiating HTTP request, constructing a front-end HTTP request according to a preset request event and the configuration file specifically includes:
[0012] In response to the initiating HTTP request, the preset request event is started to obtain a parameter checking method of the front-end HTTP request to be generated;
[0013] According to the parameter checking method, determine whether the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements, and obtain the checking result;
[0014] If the inspection result meets the preset requirements, the request parameters are divided according to the configuration file to determine the part to which the request parameters belong;
[0015] The request parameters are encapsulated according to the part to which they belong to obtain the HTTP request of the front end.
[0016] In one or more embodiments of the present specification, judging whether the request parameters passed in by the to-be-generated front-end HTTP request meet preset requirements according to the parameter checking method and obtaining the checking result specifically includes:
[0017] If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request contain preset filling parameters, and the parameter name of the request parameters corresponds to the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements;
[0018] If it is determined that the request parameters passed in by the front-end HTTP request to be generated do not contain preset filling parameters, or the parameter name of the request parameter does not match the parameter type, then the request parameters passed in by the front-end HTTP request to be generated do not meet the preset requirements.
[0019] In one or more embodiments of the present specification, dividing the request parameters according to the configuration file to determine the part to which the request parameters belong specifically includes:
[0020] Obtaining a request body and a target uniform resource locator in the HTTP request according to the configuration file;
[0021] Based on the request body and the target unified locator, each parameter in the request parameters is divided into the request header parameters of the front-end HTTP request, the specific request parameters of the front-end HTTP request and the data of the front-end HTTP request to determine the part to which each parameter in the request parameters belongs.
[0022] In one or more embodiments of the present specification, after responding to the initiating HTTP request to construct a front-end HTTP request according to the request event and the configuration file, the method further includes:
[0023] Obtain the HTTP request, and determine whether the HTTP request is abnormal based on a request event corresponding to the HTTP request;
[0024] If it is determined that the HTTP request has an exception, the HTTP request is intercepted and the exception is classified based on a preset exception handling mechanism to obtain basic information and classification information of the exception;
[0025] The abnormal information and the classification information are sent to a corresponding display device so that an operator can make statistics.
[0026] In one or more embodiments of the present specification, if it is determined that the HTTP request is abnormal, the HTTP request is intercepted and the abnormality is classified based on a preset abnormality handling mechanism, and after obtaining basic information and classification information of the abnormality, the method further includes:
[0027] Obtaining an HTTP request corresponding to the exception, and analyzing request parameters in the HTTP request to determine custom parameters in the request parameters according to parameters that do not match the request parameters with preset parameters in the configuration file;
[0028] Acquire context information of the HTTP request to determine a target request instance corresponding to the HTTP request according to the request parameters and the context information;
[0029] The custom parameters and the target request example are encapsulated to obtain the target HTTP request of the front end.
[0030] In one or more embodiments of the present specification, the configuration information includes: request method name, request protocol, input parameters, and output results; the exception handling mechanism includes at least one or more of the following: NetworkError, TimeoutErro, UnAuthenticateError, ExpiredCredentialError, and OtherErorr.
[0031] One or more embodiments of the present specification provide a front-end HTTP request construction device, the device comprising:
[0032] An acquisition unit, used to acquire version information and configuration information of the front-end HTTP request to be generated;
[0033] A first determining unit, configured to determine a configuration file and a request event of a front-end HTTP request to be generated according to the version information and the configuration information;
[0034] A second determining unit, used to determine a calling method of a front-end HTTP request to be generated according to the configuration file;
[0035] A construction unit is used to, if there is an HTTP request initiated by calling the front-end HTTP request to be generated, respond to the initiated HTTP request to construct the front-end HTTP request according to the request event and the configuration file.
[0036] One or more embodiments of this specification provide a front-end HTTP request construction device, including:
[0037] at least one processor; and,
[0038] a memory communicatively connected to the at least one processor; wherein,
[0039] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:
[0040] Get the version information and configuration information of the front-end HTTP request to be generated;
[0041] Determine the configuration file and request event of the front-end HTTP request to be generated according to the version information and the configuration information;
[0042] Determine the calling method of the front-end HTTP request to be generated according to the configuration file;
[0043] If there is an HTTP request initiated by calling the front-end HTTP request to be generated, then in response to the initiated HTTP request, a front-end HTTP request is constructed according to the request event and the configuration file.
[0044] One or more embodiments of this specification provide a non-volatile computer storage medium storing computer executable instructions, wherein the computer executable instructions are configured to:
[0045] Get the version information and configuration information of the front-end HTTP request to be generated;
[0046] Determine the configuration file and request event of the front-end HTTP request to be generated according to the version information and the configuration information;
[0047] Determine the calling method of the front-end HTTP request to be generated according to the configuration file;
[0048] If there is an HTTP request initiated by calling the front-end HTTP request to be generated, then in response to the initiated HTTP request, a front-end HTTP request is constructed according to the request event and the configuration file.
[0049] At least one of the above technical solutions adopted in the embodiments of this specification can achieve the following beneficial effects:
[0050] By defining configuration files for HTTP requests, configuration files can be used flexibly when constructing requests in different scenarios, saving request construction time, avoiding the construction of a large number of repetitive and inefficient duplicate codes, and improving development efficiency. The configuration file provides the calling method of the front-end HTTP request to the outside, so that the system can build the front-end HTTP request in response to the calling method. Building requests based on request events and configuration files reduces the probability of parameter abnormalities during the request construction process, and realizes flexible configuration of HTTP requests. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the technical solutions in the embodiments of this specification or the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art description. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. In the drawings:
[0052] Figure 1 A schematic diagram of a method flow of a method for constructing a front-end HTTP request provided in an embodiment of this specification;
[0053] Figure 2 A schematic diagram of the internal structure of a device for constructing a front-end HTTP request provided in an embodiment of this specification;
[0054] Figure 3 A schematic diagram of the internal structure of a device for constructing a front-end HTTP request provided in an embodiment of this specification;
[0055] Figure 4 A schematic diagram of the internal structure of a non-volatile storage medium provided in an embodiment of this specification. DETAILED DESCRIPTION
[0056] The embodiments of this specification provide a method, device, equipment and medium for constructing a front-end HTTP request.
[0057] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0058] like Figure 1 As shown, a flowchart of a method for constructing a front-end HTTP request is provided in one or more embodiments of this specification.
[0059] This solution is performed by the front-end server or each execution unit. Figure 1 It can be seen that the method includes the following steps:
[0060] S101: Obtain version information and configuration information of the front-end HTTP request to be generated;
[0061] Currently, when developers process HTTP requests, they use a lot of middleware such as axios, superagent, and fetchjs to construct http requests, pass parameters, and parse server returns. This results in a large amount of duplicate code in the construction process. In order to reduce the workload of code development through flexible configuration, one or more embodiments of this specification obtain the version information and configuration information of the front-end HTTP request to be generated. It should be noted that the version information can determine the version information of the current construction request based on the current construction time and the version release time, such as version. The configuration information includes: request method name, request protocol such as HTTP or HTTPS, input parameters and output results. The input parameters include required parameters and request parameters. The request parameters need to configure which part the parameter appears in, the name of the parameter and the type of the parameter. The following code shows the configuration information of the input parameters:
[0062]
[0063]
[0064] From the code example provided above, we can see that the request parameter is configured to appear in the header, the parameter name is key, and the parameter type is number. Similarly, the output result includes the return parameter, and the return parameter also needs to be configured in which part the parameter appears, the parameter name and the parameter type.
[0065] S102: Determine a configuration file of a front-end HTTP request to be generated according to the version information and the configuration information;
[0066] Since the requested configuration file includes version information and configuration information, based on the version information and configuration information obtained in step S101 above, the configuration file corresponding to the front-end HTTP request to be generated can be obtained.
[0067] S103: Determine the calling method of the front-end HTTP request to be generated according to the configuration file;
[0068] After the configuration file is obtained in the above step S101, a method for obtaining the request configuration according to the calling method of the request can be provided externally based on the configuration information in the configuration file. Therefore, the calling method of the front-end HTTP request to be generated can be determined according to the configuration file.
[0069] S104: If there is an HTTP request initiated by calling the front-end HTTP request to be generated, in response to the HTTP request being initiated, a front-end HTTP request is constructed according to a preset request event and the configuration file.
[0070] After determining the request configuration method according to the calling method according to the above steps, if an HTTP request is received through the front-end HTTP request calling method to be generated, the current front-end HTTP request will be constructed in response to the HTTP request, according to the pre-set request time and configuration file. It should be noted that the preset request events include but are not limited to the following events: validate, i.e. parameter check event, send, i.e. request sending, timeout, i.e. request timeout, data, i.e. received return data, error, i.e. request error, i.e. success request completion, and for the above events, the system can provide event monitoring.
[0071] In one or more embodiments of the present specification, in response to the initiation of the HTTP request, the front-end HTTP request is constructed according to the preset request event and the configuration file, specifically including the following steps: first, in response to the initiation of the HTTP request, the request event is opened to obtain the parameter checking method of the front-end HTTP request to be generated. Then, according to the parameter checking method, it is determined whether the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements, thereby obtaining the checking result.
[0072] Specifically, in one or more embodiments of the present specification, according to the parameter checking method, it is determined whether the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements, and the inspection results are obtained, and the specific steps are as follows: If it can be determined that there are preset filling parameters in the request parameters passed in by the front-end HTTP request to be generated, and the parameter name and parameter type of the request parameters match, then the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements. On the contrary, if it is determined that there are no preset filling parameters in the request parameters passed in by the front-end HTTP request to be generated, or the parameter name and parameter type of the request parameters do not match, then the request parameters passed in by the front-end HTTP request to be generated do not meet the preset requirements. Among them, it should be noted that the preset filling parameters are required parameters.
[0073] If the inspection result is determined to meet the preset requirements based on the above judgment, then the request parameters can be divided according to the configuration file to determine the part to which the request parameters belong. It should be noted that the request parameters for constructing the request include three parts: query, body, and header. Specifically, in one or more embodiments of the present specification, the request parameters are divided according to the configuration file to determine the part to which the request parameters belong, which specifically includes the following steps: First, the request body and the target uniform resource locator in the HTTP request need to be obtained according to the configuration file. Then, based on the request body and the target uniform locator, each parameter in the request parameters is divided into the request header parameters of the front-end HTTP request, the specific request parameters of the front-end HTTP request, and the data of the front-end HTTP request, thereby determining the part to which each parameter in the request parameters belongs. The following code shows an example of constructing the query, body, and header parameters of a request based on a configuration file in a certain application scenario:
[0074]
[0075] After determining the part to which each parameter in the request parameter belongs, the request parameter is encapsulated according to the part to which the request parameter belongs, thereby obtaining the constructed front-end HTTP request.
[0076] Since there may be various problems in the construction process or the request transmission process, the HTTP request may be abnormal. Therefore, in order to avoid the impact of abnormal events on HTTP requests. In one or more embodiments of the present specification, in response to initiating an HTTP request, after building the front-end HTTP request according to the request event and the configuration file, the method also includes the following steps: first, obtain the constructed HTTP request, and determine whether the HTTP request is abnormal according to the preset request event corresponding to the HTTP request. If the event monitoring based on the preset request event can determine that the HTTP request is abnormal. Then the HTTP request is intercepted, and the exception is classified according to the preset exception handling mechanism to obtain the basic information and classification information of the exception. It should be noted that the exception handling mechanism is based on the following method to classify the exception: NetworkError, TimeoutErro, UnAuthenticateError, ExpiredCredentialError, OtherErorr. Finally, the acquired exception information and classification information are sent to the corresponding display device so that the operator can count the exception.
[0077] In order to ensure that the processing business corresponding to each HTTP request can proceed normally, in one or more embodiments of the present specification, if it is determined that an HTTP request has an exception, the HTTP request is intercepted and the exception is classified based on a preset exception handling mechanism. After obtaining the basic information and classification information of the exception, the method also includes: obtaining the HTTP request corresponding to the exception, and analyzing the request parameters in the HTTP request, so as to determine the custom parameters in the request parameters according to the parameters that do not match the preset parameters in the configuration file. For example: the preset parameters in the preset configuration file are parameter 1, parameter 2 and parameter 3; and the request parameters are: parameter 1, parameter 4 and parameter 3, then parameter 4 is based on the custom parameters. While obtaining the custom parameters in the request parameters, the context information of the HTTP request is obtained, so as to determine the target request instance corresponding to the HTTP request based on the request parameters and the context information. Then, by encapsulating the custom parameters and the target request instance, the target HTTP request of the front end can be obtained.
[0078] like Figure 2 As shown, one or more embodiments of this specification provide a front-end HTTP request construction device, the device comprising:
[0079] The acquisition unit 201 is used to acquire the version information and configuration information of the front-end HTTP request to be generated;
[0080] A first determining unit 202 is used to determine a configuration file and a request event of a front-end HTTP request to be generated according to the version information and the configuration information;
[0081] The second determining unit 203 is used to determine the calling method of the front-end HTTP request to be generated according to the configuration file;
[0082] The construction unit 204 is used to construct a front-end HTTP request according to the request event and the configuration file in response to the initiation of the HTTP request if there is an HTTP request initiated by calling the front-end HTTP request to be generated.
[0083] In one or more embodiments of this specification, the construction unit specifically includes: a response unit, a judgment unit, a division unit, and a packaging unit;
[0084] The response unit is used to respond to the initiation of the HTTP request and start the preset request event to obtain the parameter checking method of the front-end HTTP request to be generated;
[0085] The judging unit is used to judge whether the request parameters passed in by the to-be-generated front-end HTTP request meet preset requirements according to the parameter checking method, and obtain a checking result;
[0086] The dividing unit is configured to divide the request parameters according to the configuration file to determine the part to which the request parameters belong if the inspection result meets the preset requirement;
[0087] The encapsulation unit is used to encapsulate the request parameters according to the corresponding part of the request parameters to obtain the HTTP request of the front end.
[0088] In one or more embodiments of this specification, the judgment unit specifically includes: a third determination unit, a fourth determination unit;
[0089] The third determining unit is used to determine that if there is a preset filling parameter in the request parameter passed in by the front-end HTTP request to be generated, and the parameter name of the request parameter corresponds to the parameter type, then the request parameter passed in by the front-end HTTP request to be generated meets the preset requirements;
[0090] The fourth determination unit is used to determine that if there is no preset filling parameter in the request parameter passed in by the front-end HTTP request to be generated, or the parameter name of the request parameter does not match the parameter type, then the request parameter passed in by the front-end HTTP request to be generated does not meet the preset requirements.
[0091] In one or more embodiments of this specification, the division unit specifically includes: a second acquisition unit, a division determination unit;
[0092] The second acquisition unit is used to acquire the request body and the target uniform resource locator in the HTTP request according to the configuration file;
[0093] The division determination unit is used to divide each parameter in the request parameters into request header parameters of the front-end HTTP request, specific request parameters of the front-end HTTP request and data of the front-end HTTP request based on the request body and the target unified locator, so as to determine the part to which each parameter in the request parameters belongs.
[0094] In one or more embodiments of this specification, the apparatus further includes: a third acquisition unit, a fourth acquisition unit, and a sending unit;
[0095] The third acquisition unit is used to acquire the HTTP request and determine whether the HTTP request is abnormal based on a preset request event corresponding to the HTTP request;
[0096] The fourth acquisition unit is used to intercept the HTTP request and classify the exception based on a preset exception handling mechanism to obtain basic information and classification information of the exception if it is determined that the HTTP request has an exception;
[0097] The sending unit is used to send the abnormal information and the classification information to a corresponding display device so that an operator can perform statistics.
[0098] In one or more embodiments of this specification, the device further includes: a fifth acquisition unit, a sixth acquisition unit, and a second encapsulation unit;
[0099] The fifth acquisition unit is used to acquire the HTTP request corresponding to the exception, and analyze the request parameters in the HTTP request to determine the custom parameters in the request parameters according to the parameters that do not match the request parameters and the preset parameters in the configuration file;
[0100] The sixth acquisition unit is used to acquire the context information of the HTTP request, so as to determine the target request instance corresponding to the HTTP request according to the request parameter and the context information;
[0101] The second encapsulation unit is used to encapsulate the custom parameters and the target request example to obtain the target HTTP request of the front end.
[0102] In one or more embodiments of the present specification, the configuration information includes: request method name, request protocol, input parameters, and output results; the exception handling mechanism includes at least one or more of the following: NetworkError, TimeoutErro, UnAuthenticateError, ExpiredCredentialError, and OtherErorr.
[0103] like Figure 3 As shown, one or more embodiments of this specification provide a front-end HTTP request construction device, the device comprising:
[0104] at least one processor 301; and,
[0105] A memory 302 is communicatively connected to the at least one processor 301; wherein,
[0106] The memory 302 stores instructions that can be executed by the at least one processor 301. The instructions are executed by the at least one processor 301 to enable the at least one processor 301 to:
[0107] Get the version information and configuration information of the front-end HTTP request to be generated;
[0108] Determine the configuration file and request event of the front-end HTTP request to be generated according to the version information and the configuration information;
[0109] Determine the calling method of the front-end HTTP request to be generated according to the configuration file;
[0110] If there is an HTTP request initiated by calling the front-end HTTP request to be generated, then in response to the initiated HTTP request, a front-end HTTP request is constructed according to the request event and the configuration file.
[0111] like Figure 4 As shown, one or more embodiments of this specification provide a non-volatile storage medium storing computer executable instructions 401, and the executable instructions 401 include:
[0112] Get the version information and configuration information of the front-end HTTP request to be generated;
[0113] Determine the configuration file and request event of the front-end HTTP request to be generated according to the version information and the configuration information;
[0114] Determine the calling method of the front-end HTTP request to be generated according to the configuration file;
[0115] If there is an HTTP request initiated by calling the front-end HTTP request to be generated, then in response to the initiated HTTP request, a front-end HTTP request is constructed according to the request event and the configuration file.
[0116] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0117] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0118] The above description is only one or more embodiments of this specification and is not intended to limit this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of one or more embodiments of this specification shall be included in the scope of the claims of this specification.
Claims
1. A method for constructing a front-end HTTP request. It is characterized in that The method comprises: Get the version information and configuration information of the front-end HTTP request to be generated; Determine the configuration file of the front-end HTTP request to be generated according to the version information and the configuration information; Determine the calling method of the front-end HTTP request to be generated according to the configuration file; If there is an HTTP request initiated by calling the front-end HTTP request to be generated, responding to the HTTP request to construct the front-end HTTP request according to the preset request event and the configuration file; Wherein, in response to the initiating HTTP request, constructing the front-end HTTP request according to the preset request event and the configuration file specifically includes: In response to the initiating HTTP request, the preset request event is started to obtain a parameter checking method of the front-end HTTP request to be generated; According to the parameter checking method, determine whether the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements, and obtain the checking result; If the inspection result meets the preset requirements, the request parameters are divided according to the configuration file to determine the part to which the request parameters belong; Encapsulating the request parameters according to the part to which they belong, so as to obtain the HTTP request of the front end; According to the parameter checking method, determining whether the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements, and obtaining the checking result specifically includes: If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request contain preset filling parameters, and the parameter name of the request parameters corresponds to the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements; If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request do not contain preset filling parameters, or the parameter name of the request parameters does not match the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request do not meet the preset requirements; The request parameters are divided according to the configuration file to determine the part to which the request parameters belong, specifically including: Obtaining a request body and a target uniform resource locator in the HTTP request according to the configuration file; Based on the request body and the target unified locator, each parameter in the request parameters is divided into a request header parameter of the front-end HTTP request, a specific request parameter of the front-end HTTP request and data of the front-end HTTP request, so as to determine the part to which each parameter in the request parameters belongs; In response to the initiation of the HTTP request, after constructing the front-end HTTP request according to the preset request event and the configuration file, the method further includes: Obtain the HTTP request, and determine whether the HTTP request is abnormal based on a preset request event corresponding to the HTTP request; If it is determined that the HTTP request has an exception, the HTTP request is intercepted and the exception is classified based on a preset exception handling mechanism to obtain basic information and classification information of the exception; Sending the abnormal information and the classification information to a corresponding display device so that an operator can make statistics; If it is determined that the HTTP request is abnormal, the HTTP request is intercepted and the abnormality is classified based on a preset abnormality handling mechanism. After obtaining basic information and classification information of the abnormality, the method further includes: Obtaining an HTTP request corresponding to the exception, and analyzing request parameters in the HTTP request to determine custom parameters in the request parameters according to parameters that do not match the request parameters with preset parameters in the configuration file; Acquire context information of the HTTP request to determine a target request instance corresponding to the HTTP request according to the request parameters and the context information; The custom parameters and the target request instance are encapsulated to obtain the target HTTP request of the front end.
2. According to the method for constructing a front-end HTTP request according to claim 1, It is characterized in that The configuration information includes: request method name, request protocol, input parameters, and output results; the exception handling mechanism includes at least one or more of the following: NetworkError, TimeoutErro, UnAuthenticateError, ExpiredCredentialError, and OtherErorr.
3. A front-end HTTP request construction device, It is characterized in that The device comprises: An acquisition unit, used to acquire version information and configuration information of the front-end HTTP request to be generated; A first determining unit, configured to determine a configuration file of a front-end HTTP request to be generated according to the version information and the configuration information; A second determining unit, used to determine a calling method of a front-end HTTP request to be generated according to the configuration file; A construction unit, configured to, if there is an HTTP request initiated by calling the front-end HTTP request to be generated, respond to the initiated HTTP request to construct the front-end HTTP request according to the preset request event and the configuration file; Wherein, in response to the initiating HTTP request, constructing the front-end HTTP request according to the preset request event and the configuration file specifically includes: In response to the initiating HTTP request, the preset request event is started to obtain a parameter checking method of the front-end HTTP request to be generated; According to the parameter checking method, determine whether the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements, and obtain the checking result; If the inspection result meets the preset requirements, the request parameters are divided according to the configuration file to determine the part to which the request parameters belong; Encapsulating the request parameters according to the part to which they belong, so as to obtain the HTTP request of the front end; According to the parameter checking method, determining whether the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements, and obtaining the checking result specifically includes: If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request contain preset filling parameters, and the parameter name of the request parameters corresponds to the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements; If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request do not contain preset filling parameters, or the parameter name of the request parameters does not match the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request do not meet the preset requirements; The request parameters are divided according to the configuration file to determine the part to which the request parameters belong, specifically including: Obtaining a request body and a target uniform resource locator in the HTTP request according to the configuration file; Based on the request body and the target unified locator, each parameter in the request parameters is divided into a request header parameter of the front-end HTTP request, a specific request parameter of the front-end HTTP request and data of the front-end HTTP request, so as to determine the part to which each parameter in the request parameters belongs; In response to the initiation of the HTTP request, after constructing the front-end HTTP request according to the preset request event and the configuration file, it also includes: Obtain the HTTP request, and determine whether the HTTP request is abnormal based on a preset request event corresponding to the HTTP request; If it is determined that the HTTP request has an exception, the HTTP request is intercepted and the exception is classified based on a preset exception handling mechanism to obtain basic information and classification information of the exception; Sending the abnormal information and the classification information to a corresponding display device so that an operator can make statistics; If it is determined that the HTTP request is abnormal, the HTTP request is intercepted and the abnormality is classified based on a preset abnormality handling mechanism. After obtaining basic information and classification information of the abnormality, the method further includes: Obtaining an HTTP request corresponding to the exception, and analyzing request parameters in the HTTP request to determine custom parameters in the request parameters according to parameters that do not match the request parameters with preset parameters in the configuration file; Acquire context information of the HTTP request to determine a target request instance corresponding to the HTTP request according to the request parameters and the context information; The custom parameters and the target request instance are encapsulated to obtain the target HTTP request of the front end.
4. A front-end HTTP request construction device, include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: Get the version information and configuration information of the front-end HTTP request to be generated; Determine the configuration file of the front-end HTTP request to be generated according to the version information and the configuration information; Determine the calling method of the front-end HTTP request to be generated according to the configuration file; If there is an HTTP request initiated by calling the front-end HTTP request to be generated, responding to the HTTP request to construct the front-end HTTP request according to the preset request event and the configuration file; Wherein, in response to the initiating HTTP request, constructing the front-end HTTP request according to the preset request event and the configuration file specifically includes: In response to the initiating HTTP request, the preset request event is started to obtain a parameter checking method of the front-end HTTP request to be generated; According to the parameter checking method, determine whether the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements, and obtain the checking result; If the inspection result meets the preset requirements, the request parameters are divided according to the configuration file to determine the part to which the request parameters belong; Encapsulating the request parameters according to the part to which they belong, so as to obtain the HTTP request of the front end; According to the parameter checking method, determining whether the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements, and obtaining the checking result specifically includes: If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request contain preset filling parameters, and the parameter name of the request parameters corresponds to the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements; If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request do not contain preset filling parameters, or the parameter name of the request parameters does not match the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request do not meet the preset requirements; The request parameters are divided according to the configuration file to determine the part to which the request parameters belong, specifically including: Obtaining a request body and a target uniform resource locator in the HTTP request according to the configuration file; Based on the request body and the target unified locator, each parameter in the request parameters is divided into a request header parameter of the front-end HTTP request, a specific request parameter of the front-end HTTP request and data of the front-end HTTP request, so as to determine the part to which each parameter in the request parameters belongs; In response to the initiation of the HTTP request, after constructing the front-end HTTP request according to the preset request event and the configuration file, it also includes: Obtain the HTTP request, and determine whether the HTTP request is abnormal based on a preset request event corresponding to the HTTP request; If it is determined that the HTTP request has an exception, the HTTP request is intercepted and the exception is classified based on a preset exception handling mechanism to obtain basic information and classification information of the exception; Sending the abnormal information and the classification information to a corresponding display device so that an operator can make statistics; If it is determined that the HTTP request is abnormal, the HTTP request is intercepted and the abnormality is classified based on a preset abnormality handling mechanism. After obtaining basic information and classification information of the abnormality, the method further includes: Obtaining an HTTP request corresponding to the exception, and analyzing request parameters in the HTTP request to determine custom parameters in the request parameters according to parameters that do not match the request parameters with preset parameters in the configuration file; Acquire context information of the HTTP request to determine a target request instance corresponding to the HTTP request according to the request parameters and the context information; The custom parameters and the target request instance are encapsulated to obtain the target HTTP request of the front end.
5. A non-volatile storage medium storing computer executable instructions, It is characterized in that The executable instructions include: Get the version information and configuration information of the front-end HTTP request to be generated; Determine the configuration file of the front-end HTTP request to be generated according to the version information and the configuration information; Determine the calling method of the front-end HTTP request to be generated according to the configuration file; If there is an HTTP request initiated by calling the front-end HTTP request to be generated, responding to the HTTP request to construct the front-end HTTP request according to the preset request event and the configuration file; Wherein, in response to the initiating HTTP request, constructing the front-end HTTP request according to the preset request event and the configuration file specifically includes: In response to the initiating HTTP request, the preset request event is started to obtain a parameter checking method of the front-end HTTP request to be generated; According to the parameter checking method, determine whether the request parameters passed in by the front-end HTTP request to be generated meet the preset requirements, and obtain the checking result; If the inspection result meets the preset requirements, the request parameters are divided according to the configuration file to determine the part to which the request parameters belong; Encapsulating the request parameters according to the part to which they belong, so as to obtain the HTTP request of the front end; According to the parameter checking method, determining whether the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements, and obtaining the checking result specifically includes: If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request contain preset filling parameters, and the parameter name of the request parameters corresponds to the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request meet the preset requirements; If it is determined that the request parameters passed in by the to-be-generated front-end HTTP request do not contain preset filling parameters, or the parameter name of the request parameters does not match the parameter type, then the request parameters passed in by the to-be-generated front-end HTTP request do not meet the preset requirements; The request parameters are divided according to the configuration file to determine the part to which the request parameters belong, specifically including: Obtaining a request body and a target uniform resource locator in the HTTP request according to the configuration file; Based on the request body and the target unified locator, each parameter in the request parameters is divided into a request header parameter of the front-end HTTP request, a specific request parameter of the front-end HTTP request and data of the front-end HTTP request, so as to determine the part to which each parameter in the request parameters belongs; In response to the initiation of the HTTP request, after constructing the front-end HTTP request according to the preset request event and the configuration file, it also includes: Obtain the HTTP request, and determine whether the HTTP request is abnormal based on a preset request event corresponding to the HTTP request; If it is determined that the HTTP request has an exception, the HTTP request is intercepted and the exception is classified based on a preset exception handling mechanism to obtain basic information and classification information of the exception; Sending the abnormal information and the classification information to a corresponding display device so that an operator can make statistics; If it is determined that the HTTP request is abnormal, the HTTP request is intercepted and the abnormality is classified based on a preset abnormality handling mechanism. After obtaining basic information and classification information of the abnormality, the method further includes: Obtaining an HTTP request corresponding to the exception, and analyzing request parameters in the HTTP request to determine custom parameters in the request parameters according to parameters that do not match the request parameters with preset parameters in the configuration file; Acquire context information of the HTTP request to determine a target request instance corresponding to the HTTP request according to the request parameters and the context information; The custom parameters and the target request instance are encapsulated to obtain the target HTTP request of the front end.
