CN114553966A - Front-end Http request construction method, device, equipment and medium - Google Patents

Front-end Http request construction method, device, equipment and medium Download PDF

Info

Publication number
CN114553966A
CN114553966A CN202210071444.9A CN202210071444A CN114553966A CN 114553966 A CN114553966 A CN 114553966A CN 202210071444 A CN202210071444 A CN 202210071444A CN 114553966 A CN114553966 A CN 114553966A
Authority
CN
China
Prior art keywords
request
http request
parameters
generated
http
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210071444.9A
Other languages
Chinese (zh)
Inventor
张世旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Inspur Genersoft Information Technology Co Ltd
Original Assignee
Shandong Inspur Genersoft Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Inspur Genersoft Information Technology Co Ltd filed Critical Shandong Inspur Genersoft Information Technology Co Ltd
Priority to CN202210071444.9A priority Critical patent/CN114553966A/en
Publication of CN114553966A publication Critical patent/CN114553966A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Abstract

The embodiment of the specification discloses a method, a device, equipment and a medium for constructing a front-end HTTP request, which are used for reducing the workload of code development and improving the development efficiency. The method comprises the following steps: acquiring version information and configuration information of a front-end HTTP request to be generated; determining 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; determining a calling mode of a front-end HTTP request to be generated according to the configuration file; if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the initiated HTTP request to construct the front-end HTTP request according to the request event and the configuration file, reducing the development workload of codes and improving the development efficiency through flexible configuration.

Description

Front-end Http request construction method, device, equipment and medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a medium for constructing a front-end Http request.
Background
The HTTP request refers to a request message from a client to a server. The method comprises the following steps: in the message head line, the request method for the resource, the identifier of the resource and the protocol used. Many http requests are required in the current software running process, including requests from a client to a server or requests from the server to the server. And the fast construction of the HTTP request is an important link in the HTTP request and response process.
At present, developers use many middleware such as axios, agent, fetchjs to construct HTTP requests, pass parameters, and analyze server returns when processing HTTP requests. However, with the development of technology, the current network application needs more and more functions to be edited. Accordingly, the code logic becomes more and more complex and the probability of errors is higher and higher. And when the application scenes of the HTTP requests are different and the parameters are different, a large amount of work of constructing the requests and processing the return values is needed. At the moment, the code is edited again based on the developer, so that the efficiency is low, the maintenance is inconvenient, and the development efficiency is greatly influenced.
Disclosure of Invention
One or more embodiments of the present specification provide a method for constructing an HTTP request of a front end, so as to solve the following technical problems: how to provide an efficient front-end HTTP request construction method.
One or more embodiments of the present disclosure adopt the following technical solutions:
one or more embodiments of the present specification provide a method for constructing an HTTP request of a front end, the method including:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining a configuration file of a front-end HTTP request to be generated according to the version information and the configuration information;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct the front-end HTTP request according to a preset request event and the configuration file.
In one or more embodiments of the present specification, the responding to the initiated HTTP request to construct a front-end HTTP request according to a preset request event and the configuration file specifically includes:
responding to the HTTP initiating request, starting the preset request event to acquire a parameter checking mode of the front-end HTTP request to be generated;
judging whether the request parameters transmitted by the front-end HTTP request to be generated meet preset requirements or not according to the parameter checking mode, and obtaining a checking result;
if the checking result meets the preset requirement, dividing the request parameter according to the configuration file to determine the part of the request parameter;
and encapsulating the request parameters according to the part of the request parameters to obtain the HTTP request of the front end.
In one or more embodiments of the present specification, the determining, according to the parameter checking manner, whether a request parameter transmitted by the front-end HTTP request to be generated meets a preset requirement, and obtaining a checking result specifically includes:
if it is determined that preset filling parameters exist in the request parameters transmitted by the front-end HTTP request to be generated and the parameter names of the request parameters correspond to the parameter types, the request parameters transmitted by the front-end HTTP request to be generated meet preset requirements;
if it is determined that no preset filling parameters exist in the request parameters transmitted by the front-end HTTP request to be generated, or the parameter names of the request parameters are not matched with the parameter types, the request parameters transmitted by the front-end HTTP request to be generated do not meet preset requirements.
In one or more embodiments of the present specification, the dividing the request parameter according to the configuration file to determine the part of the request parameter specifically includes:
acquiring a request main body and a target uniform resource locator in the HTTP request according to the configuration file;
dividing each parameter in the request parameters 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 based on the request body and the target uniform locator so as to determine the part of each parameter in the request parameters.
In one or more embodiments of the present specification, after the responding to the initiated HTTP request to construct an HTTP request of a front end according to the request event and the configuration file, the method further includes:
acquiring the HTTP request, and determining whether the HTTP request is abnormal or not based on a request event corresponding to the HTTP request;
if the HTTP request is determined to be abnormal, intercepting the HTTP request and classifying the abnormality based on a preset abnormality processing mechanism to obtain basic information and classification information of the abnormality;
and sending the abnormal information and the classification information to corresponding display equipment so as to facilitate statistics of operators.
In one or more embodiments of the present specification, 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, and after obtaining basic information and classification information of the exception, the method further includes:
acquiring an HTTP request corresponding to the abnormality, analyzing request parameters in the HTTP request, and determining custom parameters in the request parameters according to parameters of which the request parameters are not matched with preset parameters in the configuration file;
acquiring 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;
and encapsulating the custom parameter and the target request example to obtain a target HTTP request of the front end.
In one or more embodiments of the present description, the configuration information includes: the method comprises the following steps of requesting a method name, requesting a protocol, inputting parameters and outputting a result; the exception handling mechanism comprises at least any one or more of: NetworkError, Timeouterro, Unauthenticaterror, ExpireddirentialError, OtherError.
One or more embodiments of the present specification provide an apparatus for constructing an HTTP request of a front end, the apparatus including:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring version information and configuration information of a front-end HTTP request to be generated;
the first determining unit is used for determining 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;
the second determining unit is used for determining a calling mode of the front-end HTTP request to be generated according to the configuration file;
and the construction unit is used for responding to the HTTP initiating request to construct the front-end HTTP request according to the request event and the configuration file if the front-end HTTP initiating request exists in a front-end HTTP request calling mode to be generated.
One or more embodiments of the present specification provide a front-end HTTP request construction apparatus, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining 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;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct a front-end HTTP request according to the request event and the configuration file.
One or more embodiments of the present specification provide a non-transitory computer storage medium storing computer-executable instructions configured to:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining 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;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct a front-end HTTP request according to the request event and the configuration file.
The embodiment of the specification adopts at least one technical scheme which can achieve the following beneficial effects:
by defining the configuration file for the HTTP request, the configuration file can be flexibly used to save the request construction time when constructing the request under different scenes, thereby avoiding constructing a large amount of repeated and inefficient repeated codes and improving the development efficiency. The configuration file provides the calling mode of the front-end HTTP request to the outside, so that the system can respond to the calling mode to construct the front-end HTTP request, the probability of parameter abnormity in the request construction process is reduced based on the request event and the configuration file construction request, and the flexible configuration of the HTTP request is realized.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present specification, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort. In the drawings:
fig. 1 is a schematic method flow diagram of a method for constructing an HTTP request of a front end according to an embodiment of the present disclosure;
fig. 2 is a schematic internal structural diagram of a front-end apparatus for constructing an HTTP request according to an embodiment of the present disclosure;
fig. 3 is a schematic internal structural diagram of a device for constructing an HTTP request of a front end according to an embodiment of the present specification;
fig. 4 is a schematic diagram of an internal structure of a nonvolatile storage medium according to an embodiment of the present disclosure.
Detailed Description
The embodiment of the specification provides a method, a device, equipment and a medium for constructing an HTTP request of a front end.
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present specification without any creative effort shall fall within the protection scope of the present specification.
As shown in fig. 1, in one or more embodiments of the present specification, a flow diagram of a method for constructing an HTTP request of a front end is provided.
The method is executed by a server or each execution unit at the front end, and as can be seen from fig. 1, the method comprises the following steps:
s101: acquiring version information and configuration information of a front-end HTTP request to be generated;
at present, developers use many middleware such as axios, agent and fetchjs for constructing HTTP requests, transmitting parameters and analyzing server returns when processing HTTP requests. So that a large number of duplicate codes appear in the construction process. In order to reduce the workload of code development through flexible configuration, in one or more embodiments of the present specification, version information and configuration information of a front-end HTTP request to be generated are acquired. It should be noted that the version information may determine the version information at the time of the current construction request based on the current construction time and the version release time, for example, version. The configuration information includes: the name of the requesting method, the requesting protocol, e.g., HTTP or HTTPs, the input parameters and the output results. The input parameters include a required filling parameter and a request parameter, the request parameter needs to configure in which part the parameter appears, the name of the parameter and the type of the parameter, and the following codes are shown as configuration information of the input parameters:
Figure BDA0003482230160000061
Figure BDA0003482230160000071
as can be seen from the code example provided above, the request parameter is configured to appear in the header, the name of the parameter is key, and the type of the parameter is number. Similarly, the output result includes a return parameter, and the return parameter also needs to configure which part of the parameter appears, the name of the parameter, and the type of the parameter.
S102: determining a configuration file of a front-end HTTP request to be generated according to the version information and the configuration information;
since the requested configuration file includes version information and configuration information, the configuration file corresponding to the front-end HTTP request to be generated can be obtained based on the version information and the configuration information acquired in step S101.
S103: determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
after the configuration file is obtained in step S101, a method for obtaining the requested configuration according to the requested calling method may be provided to the outside based on the configuration information in the configuration file. Therefore, the calling mode of the front-end HTTP request to be generated can be determined according to the configuration file.
S104: and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct the front-end HTTP request according to a preset request event and the configuration file.
After determining to acquire the request configuration method according to the calling method according to the steps, if an HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the initiated HTTP request, and constructing the current front-end HTTP request according to preset request time and a configuration file. It should be noted that the preset request event includes, but is not limited to, the following events: for the events, the system can provide event monitoring.
In one or more embodiments of the present specification, in response to the initiating HTTP request, building a front-end HTTP request according to a preset request event and a configuration file, specifically including the following steps: first, in response to initiating an HTTP request, a request event is started, thereby obtaining a parameter check mode of a front-end HTTP request to be generated. And then judging whether the request parameters transmitted by the front-end HTTP request to be generated meet the preset requirements or not according to the parameter checking mode, thereby obtaining a checking result.
Specifically, in one or more embodiments of the present specification, according to a parameter checking manner, determining whether a request parameter transmitted by a front-end HTTP request to be generated meets a preset requirement, and obtaining a checking result, specifically, the following steps are performed: if it can be determined that the preset filling parameters exist in the request parameters of the front-end HTTP request to be generated, and the parameter names of the request parameters match with the parameter types, the request parameters of the front-end HTTP request to be generated meet the preset requirements. On the contrary, if it is determined that no preset filling parameter exists in the request parameters of the front-end HTTP request to be generated, or the parameter names and the parameter types of the request parameters are not matched, the request parameters of the front-end HTTP request to be generated do not meet the preset requirements. It should be noted that the preset filling parameter is a required filling parameter.
If the checking result is determined to meet the preset requirement based on the judgment, the request parameters can be divided according to the configuration file to determine the part of the request parameters. It should be noted that the request parameters for constructing the request include: query, body and header. Specifically, in one or more embodiments of the present specification, the dividing the request parameter according to the configuration file to determine the part of the request parameter specifically includes the following steps: first, a request body and a target uniform resource locator in an HTTP request need to be obtained according to a configuration file. Then, based on the request main body and the target uniform locator, dividing each parameter in the request parameters 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, and further determining the part of each parameter in the request parameters. The following codes show examples of query, body, and header parameters for constructing a request based on a configuration file in an application scenario:
Figure BDA0003482230160000081
and after determining the part of each parameter in the request parameters, packaging the request parameters according to the part of the request parameters, thereby obtaining the constructed HTTP request of the front end.
Various problems may exist in the construction process or the request transmission process, so that the HTTP request is abnormal. Therefore, the effect of the abnormal event on the HTTP request is avoided. In one or more embodiments of the present specification, in response to initiating the HTTP request to build the HTTP request of the front end according to the request event and the configuration file, the method further comprises the steps of: firstly, a constructed HTTP request is obtained, and whether the HTTP request is abnormal or not is determined according to a preset request event corresponding to the HTTP request. If the event monitoring is based on the preset request event, the HTTP request can be determined to have an exception. Then the HTTP request is intercepted, and the exception is classified according to a preset exception handling mechanism, so that basic information and classification information of the exception are obtained. Wherein, it is required to be noted that: the exception handling mechanism classifies exceptions based on the following methods: NetworkError, Timeouterro, Unauthenticaterror, ExpireddirentialError, OtherError. And finally, sending the acquired abnormal information and the classification information to corresponding display equipment so that an operator can count the abnormality.
In order to ensure that processing services corresponding to each HTTP request can be performed normally, in one or more embodiments of the present specification, if it is determined that an HTTP request is abnormal, the HTTP request is intercepted and the abnormality is classified based on a preset abnormality processing mechanism, and after obtaining basic information and classification information of the abnormality, the method further includes: and acquiring the HTTP request corresponding to the abnormality, and analyzing the request parameters in the HTTP request, so as to determine the custom parameters in the request parameters according to the parameters of which the request parameters are not matched with the preset parameters in the configuration file. For example: presetting parameters as parameter 1, parameter 2 and parameter 3 in the preset configuration file; and the request parameters are: parameter 1, parameter 4, and parameter 3, then parameter 4 is based on the custom parameter. And acquiring the self-defined parameters in the request parameters and simultaneously acquiring the context information of the HTTP request so as to determine a target request instance corresponding to the HTTP request according to the request parameters and the context information. And then, the target HTTP request of the front end can be obtained by encapsulating the custom parameters and the target request instance.
As shown in fig. 2, one or more embodiments of the present specification provide a front-end HTTP request constructing apparatus, including:
an obtaining unit 201, configured to obtain version information and configuration information of a front-end HTTP request to be generated;
a first determining unit 202, configured to determine, according to the version information and the configuration information, a configuration file and a request event of a front-end HTTP request to be generated;
a second determining unit 203, configured to determine, according to the configuration file, a calling manner of a front-end HTTP request to be generated;
the constructing unit 204 is configured to respond to the HTTP request to be initiated if there is an HTTP request initiated in a front-end HTTP request invoking manner to be generated, so as to construct a front-end HTTP request according to the request event and the configuration file.
In one or more embodiments of the present specification, the building unit specifically includes: the device comprises a response unit, a judgment unit, a dividing unit and a packaging unit;
the response unit is used for responding to the HTTP initiation request, starting the preset request event and acquiring a parameter checking mode of the front-end HTTP request to be generated;
the judging unit is used for judging whether the request parameters transmitted by the front-end HTTP request to be generated meet the preset requirements or not according to the parameter checking mode, and obtaining a checking result;
the dividing unit is used for dividing the request parameters according to the configuration file to determine the part of the request parameters if the checking result meets the preset requirement;
the encapsulation unit is configured to encapsulate the request parameter according to the part to which the request parameter belongs, so as to obtain the HTTP request of the front end.
In one or more embodiments of the present specification, the determining unit specifically includes: a third determining unit and a fourth determining unit;
the third determining unit is configured to, if it is determined that a preset filling parameter exists in the request parameter incoming to the front-end HTTP request to be generated and the parameter name of the request parameter corresponds to the parameter type, determine that the request parameter incoming to the front-end HTTP request to be generated meets a preset requirement;
the fourth determining unit is configured to determine that the request parameters incoming to the front-end HTTP request to be generated do not meet preset requirements if it is determined that preset filling parameters do not exist in the request parameters incoming to the front-end HTTP request to be generated, or the parameter names of the request parameters are not matched with the parameter types.
In one or more embodiments of the present specification, the dividing unit specifically includes: a second obtaining unit and a division determining unit;
the second obtaining unit is used for obtaining a request main body and a target uniform resource locator in the HTTP request according to the configuration file;
the dividing and determining unit is configured to divide each parameter in the request parameters 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 based on the request body and the target uniform locator, so as to determine a part to which each parameter in the request parameters belongs.
In one or more embodiments of the present specification, the apparatus further comprises: a third acquisition unit, a fourth acquisition unit and a sending unit;
the third acquiring unit is used for acquiring the HTTP request and determining whether the HTTP request is abnormal or not based on a preset request event corresponding to the HTTP request;
the fourth obtaining unit is configured to intercept the HTTP request and classify the HTTP request based on a preset exception handling mechanism if it is determined that the HTTP request is abnormal, so as to obtain basic information and classification information of the exception;
and the sending unit is used for sending the abnormal information and the classification information to corresponding display equipment so as to facilitate statistics of operators.
In one or more embodiments of the present description, the apparatus further comprises: a fifth obtaining unit, a sixth obtaining unit and a second packaging unit;
the fifth obtaining unit is configured to obtain the HTTP request corresponding to the anomaly, and analyze request parameters in the HTTP request to determine custom parameters in the request parameters according to parameters that the request parameters do not match preset parameters in the configuration file;
the sixth obtaining unit is configured to obtain context information of the HTTP request, so as to determine a target request instance corresponding to the HTTP request according to the request parameter and the context information;
the second encapsulating unit is configured to encapsulate the custom parameter and the target request example to obtain the target HTTP request of the front end.
In one or more embodiments of the present description, the configuration information includes: the method comprises the following steps of requesting a method name, requesting a protocol, inputting parameters and outputting a result; the exception handling mechanism comprises at least any one or more of: NetworkError, Timeouterro, Unauthenticaterror, ExpireddirentialError, OtherError.
As shown in fig. 3, in one or more embodiments of the present specification, there is provided a front-end HTTP request constructing apparatus, including:
at least one processor 301; and the number of the first and second groups,
a memory 302 communicatively coupled to the at least one processor 301; wherein the content of the first and second substances,
the memory 302 stores instructions executable by the at least one processor 301 to cause the at least one processor 301 to:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining 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;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct a front-end HTTP request according to the request event and the configuration file.
As shown in fig. 4, one or more embodiments of the present description provide a non-volatile storage medium storing computer-executable instructions 401, where the executable instructions 401 include:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining 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;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct a front-end HTTP request according to the request event and the configuration file.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the device, and the nonvolatile computer storage medium, since they are substantially similar to the embodiments of the method, the description is simple, and for the relevant points, reference may be made to the partial description of the embodiments of the method.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The above description is merely one or more embodiments of the present disclosure and is not intended to limit the present disclosure. Various modifications and alterations to one or more embodiments of the present description will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of one or more embodiments of the present specification should be included in the scope of the claims of the present specification.

Claims (10)

1. A method for constructing an HTTP request from a front end, the method comprising:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining a configuration file of a front-end HTTP request to be generated according to the version information and the configuration information;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct the front-end HTTP request according to a preset request event and the configuration file.
2. The method according to claim 1, wherein the responding to the HTTP request to construct a front-end HTTP request according to a preset request event and the configuration file includes:
responding to the HTTP initiating request, starting the preset request event to acquire a parameter checking mode of the front-end HTTP request to be generated;
judging whether the request parameters transmitted by the front-end HTTP request to be generated meet preset requirements or not according to the parameter checking mode, and obtaining a checking result;
if the checking result meets the preset requirement, dividing the request parameter according to the configuration file to determine the part of the request parameter;
and encapsulating the request parameters according to the part of the request parameters to obtain the HTTP request of the front end.
3. The method as claimed in claim 2, wherein the determining, according to the parameter checking manner, whether the request parameter transmitted by the front-end HTTP request to be generated meets a preset requirement to obtain a checking result specifically includes:
if it is determined that preset filling parameters exist in the request parameters transmitted by the front-end HTTP request to be generated and the parameter names of the request parameters correspond to the parameter types, the request parameters transmitted by the front-end HTTP request to be generated meet preset requirements;
if it is determined that no preset filling parameters exist in the request parameters transmitted by the front-end HTTP request to be generated, or the parameter names of the request parameters are not matched with the parameter types, the request parameters transmitted by the front-end HTTP request to be generated do not meet preset requirements.
4. The method according to claim 2, wherein the dividing the request parameters according to the configuration file to determine the part of the request parameters specifically includes:
acquiring a request main body and a target uniform resource locator in the HTTP request according to the configuration file;
dividing each parameter in the request parameters 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 based on the request body and the target uniform locator so as to determine the part of each parameter in the request parameters.
5. The method as claimed in claim 1, wherein after the responding to the initiating HTTP request to construct the HTTP request of the front end according to the preset request event and the configuration file, the method further comprises:
acquiring the HTTP request, and determining whether the HTTP request is abnormal or not based on a preset request event corresponding to the HTTP request;
if the HTTP request is determined to be abnormal, intercepting the HTTP request and classifying the abnormality based on a preset abnormality processing mechanism to obtain basic information and classification information of the abnormality;
and sending the abnormal information and the classification information to corresponding display equipment so as to facilitate statistics of an operator.
6. The method as claimed in claim 5, wherein 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, and after obtaining basic information and classification information of the exception, the method further comprises:
acquiring an HTTP request corresponding to the abnormality, analyzing request parameters in the HTTP request, and determining custom parameters in the request parameters according to parameters of which the request parameters are not matched with preset parameters in the configuration file;
acquiring 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;
and encapsulating the custom parameter and the target request example to obtain a target HTTP request of the front end.
7. The method of claim 5, wherein the configuration information comprises: the method comprises the following steps of requesting a method name, requesting a protocol, inputting parameters and outputting a result; the exception handling mechanism comprises at least any one or more of: NetworkError, Timeouterro, Unauthenticaterror, ExpireddirentialError, OtherError.
8. An apparatus for constructing an HTTP request from a front end, the apparatus comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring version information and configuration information of a front-end HTTP request to be generated;
the first determining unit is used for determining a configuration file of the front-end HTTP request to be generated according to the version information and the configuration information;
the second determining unit is used for determining a calling mode of the front-end HTTP request to be generated according to the configuration file;
and the construction unit is used for responding to the HTTP initiating request to construct the front-end HTTP request according to a preset request event and the configuration file if the front-end HTTP initiating request exists in a front-end HTTP request calling mode to be generated.
9. A front-end HTTP request construction apparatus, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining a configuration file of a front-end HTTP request to be generated according to the version information and the configuration information;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct the front-end HTTP request according to a preset request event and the configuration file.
10. A non-volatile storage medium storing computer-executable instructions, the executable instructions comprising:
acquiring version information and configuration information of a front-end HTTP request to be generated;
determining a configuration file of a front-end HTTP request to be generated according to the version information and the configuration information;
determining a calling mode of a front-end HTTP request to be generated according to the configuration file;
and if the HTTP request is initiated in a front-end HTTP request calling mode to be generated, responding to the HTTP initiating request to construct the front-end HTTP request according to a preset request event and the configuration file.
CN202210071444.9A 2022-01-21 2022-01-21 Front-end Http request construction method, device, equipment and medium Pending CN114553966A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210071444.9A CN114553966A (en) 2022-01-21 2022-01-21 Front-end Http request construction method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210071444.9A CN114553966A (en) 2022-01-21 2022-01-21 Front-end Http request construction method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114553966A true CN114553966A (en) 2022-05-27

Family

ID=81672490

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210071444.9A Pending CN114553966A (en) 2022-01-21 2022-01-21 Front-end Http request construction method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114553966A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2512101A1 (en) * 2011-04-11 2012-10-17 Deutsche Telekom AG Method and system to pre-fetch user-specific HTTP requests for web applications
CN110457144A (en) * 2019-08-05 2019-11-15 北京字节跳动网络技术有限公司 A kind of method, apparatus that realizing front end applications, medium and equipment
CN111221572A (en) * 2020-01-13 2020-06-02 北京字节跳动网络技术有限公司 Method, device, medium and equipment for automatically adapting to operating environment
CN112965739A (en) * 2021-02-08 2021-06-15 中国工商银行股份有限公司 Front-end HTTP request processing method, device and system
CN113225379A (en) * 2021-03-31 2021-08-06 北京三快在线科技有限公司 Method and device for sending HTTP request message

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2512101A1 (en) * 2011-04-11 2012-10-17 Deutsche Telekom AG Method and system to pre-fetch user-specific HTTP requests for web applications
CN110457144A (en) * 2019-08-05 2019-11-15 北京字节跳动网络技术有限公司 A kind of method, apparatus that realizing front end applications, medium and equipment
CN111221572A (en) * 2020-01-13 2020-06-02 北京字节跳动网络技术有限公司 Method, device, medium and equipment for automatically adapting to operating environment
CN112965739A (en) * 2021-02-08 2021-06-15 中国工商银行股份有限公司 Front-end HTTP request processing method, device and system
CN113225379A (en) * 2021-03-31 2021-08-06 北京三快在线科技有限公司 Method and device for sending HTTP request message

Similar Documents

Publication Publication Date Title
CN111083225B (en) Data processing method and device in Internet of things platform and Internet of things platform
WO2020029375A1 (en) Interface testing method and system, and computer device and storage medium
CN107370806B (en) HTTP status code monitoring method, device, storage medium and electronic equipment
WO2020259003A1 (en) Link tracking method and apparatus
CN110309029B (en) Abnormal data acquisition method and device, computer equipment and storage medium
WO2022016847A1 (en) Automatic test method and device applied to cloud platform
CN111694797A (en) File uploading and analyzing method, device, server and medium
CN110780870A (en) Service execution method, device, equipment and storage medium
US20230046979A1 (en) Microservice call method and apparatus, device, and medium
CN112788128A (en) Business information pushing method and device, storage medium and electronic device
CN111147310A (en) Log tracking processing method, device, server and medium
CN112559285A (en) Distributed service architecture-based micro-service monitoring method and related device
CN113360301A (en) Message transmission system and method
CN110457132B (en) Method and device for creating functional object and terminal equipment
CN111858113B (en) Application program repairing method and device, service system and storage medium
CN113806169A (en) Method and device for processing business exception
CN112527600A (en) Monitoring log processing method, device, equipment and storage medium
CN114553966A (en) Front-end Http request construction method, device, equipment and medium
CN116668520A (en) Gateway-based service arrangement method, system, equipment and storage medium
CN111352810A (en) Performance monitoring method and device based on multiple processes and computing equipment
CN114510398A (en) Anomaly monitoring method, apparatus, device, system and medium
CN115174683B (en) Request method and system for calling query interface
CN111522642B (en) Method for acquiring and inquiring state monitoring data of wind turbine generator, and electronic equipment
CN116881078A (en) Monitoring method and device based on call chain network, electronic equipment and storage medium
CN114003410A (en) Message-based flink real-time service scheduling configuration method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination