Network request processing method and device
By introducing network request implementation scheme and interceptor chain into network requests, decoupling network requests and network request libraries, the problem of modifying a large number of business codes when updating or replacing network request libraries in the prior art is solved, and a more flexible and efficient network request processing is achieved.
Patent Information
- Application Number
- CN202311810588.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-26
- Publication Date
- 2025-06-27
AI Technical Summary
In the prior art, the network request library is coupled with business logic, resulting in the need to modify a large amount of business code when updating or replacing the network request library, which increases R&D and maintenance costs.
By determining the network request implementation scheme, the network request is decoupled from a specific network request library, the processed network request is sent to the server using a network request interceptor, and data processing is performed through the interceptor chain.
It realizes decoupling of network requests from network request databases, reduces R&D and maintenance costs, improves data processing efficiency and flexibility, supports different data processing needs, and is compatible with old business logic.
Smart Images

Figure CN120223754A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a method and apparatus for processing network requests. Background Art
[0002] An application can initiate a network request to a server, obtain data from the server, and display it on the front-end page. Generally, a pre-packaged network request library is used in the application to initiate a network request to the server. For example, during the cross-platform development of Flutter on mobile devices, developers usually choose the Dio library provided by a third party to implement the function of the application initiating a network request. The network request library is coupled with the business logic of initiating a network request and can provide multiple request methods such as GET, POST, and DELETE. Among them, the GET request method is used to request specified page information and return the request result, the POST request method is used to submit data to a specified resource for processing the request, and the DELETE request method is used to request the server to delete specified page information.
[0003] In the process of implementing the present invention, the inventors found that the prior art has at least the following problems:
[0004] Since the network request library is coupled with the business logic, when the business logic is updated or replaced with another network request library, a large amount of business code needs to be modified, resulting in high R & D costs and maintenance costs. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and apparatus for processing network requests, which can decouple network requests from a specific network request library, initiate network requests more flexibly, and reduce R & D costs and maintenance costs.
[0006] To achieve the above object, according to the first aspect of the embodiments of the present invention, a method for processing a network request is provided, including:
[0007] In response to receiving a network request, determining a corresponding network request implementation solution, and determining a corresponding network request interceptor according to the network request implementation solution;
[0008] Performing data processing on the network request, and passing the network request after data processing to the network request interceptor;
[0009] Sending the network request after data processing to a corresponding server according to the network request interceptor.
[0010] Optionally, performing data processing on the network request, and passing the network request after data processing to the network request interceptor includes:
[0011] Determine the interceptor chain corresponding to the network request interceptor, and recursively process the network request according to the multiple custom interceptors included in the interceptor chain;
[0012] Transmit the recursive processing result of the network request to the network request interceptor.
[0013] Optionally, determining the interceptor chain corresponding to the network request interceptor includes:
[0014] Determine the interceptor code corresponding to the network request, and determine the corresponding interceptor list according to the interceptor code;
[0015] Determine the interceptor chain corresponding to the network request interceptor according to the interceptor list.
[0016] Optionally, in the case where the interceptor code corresponding to the network request is not determined, the method further includes:
[0017] Determine the default interceptor list corresponding to the network request interceptor;
[0018] Determine the interceptor chain corresponding to the network request interceptor according to the default interceptor list.
[0019] Optionally, the method further includes:
[0020] Receive the response result of the network request according to the network request interceptor;
[0021] Perform reverse recursive processing on the response result of the network request according to the multiple custom interceptors included in the interceptor chain;
[0022] Transmit the reverse recursive processing result of the response result to the initiator of the network request.
[0023] Optionally, after recursively processing the network request according to the multiple custom interceptors included in the interceptor chain, the method further includes: Except for the last interceptor in the recursive processing process, store the recursive processing result generated by each interceptor along the interceptor chain to the next interceptor;
[0024] After receiving the response result of the network request, the method further includes: In response to detecting that the reverse recursive processing of the target interceptor fails, obtain the target recursive processing result stored in the target interceptor; Starting from the target interceptor, recursively process the target recursive processing result along the interceptor chain to obtain the retry processing result of the network request; According to the network request interceptor, send the retry processing result to the corresponding server to obtain the retry response result of the network request.
[0025] Optionally, before receiving a network request, the method further includes:
[0026] In response to receiving a target network request implementation solution, generate a corresponding target network request implementation class, globally store the target network request implementation class, and use the target network request implementation class as a network request interceptor corresponding to the target network request implementation solution.
[0027] According to a second aspect of an embodiment of the present invention, there is provided a network request processing apparatus, including:
[0028] A determination module, configured to, in response to receiving a network request, determine a corresponding network request implementation solution, and determine a corresponding network request interceptor according to the network request implementation solution;
[0029] A processing module, configured to perform data processing on the network request, and pass the network request after data processing to the network request interceptor;
[0030] A sending module, configured to send the network request after data processing to a corresponding server according to the network request interceptor.
[0031] Optionally, performing data processing on the network request, and passing the network request after data processing to the network request interceptor includes:
[0032] Determine an interceptor chain corresponding to the network request interceptor, and recursively process the network request according to a plurality of custom interceptors included in the interceptor chain;
[0033] Pass the recursive processing result of the network request to the network request interceptor.
[0034] Optionally, determining an interceptor chain corresponding to the network request interceptor includes:
[0035] Determine an interceptor code corresponding to the network request, and determine a corresponding interceptor list according to the interceptor code;
[0036] Determine an interceptor chain corresponding to the network request interceptor according to the interceptor list.
[0037] Optionally, the apparatus further includes:
[0038] A second determination module, configured to determine a default interceptor list corresponding to the network request interceptor;
[0039] A third determination module, configured to determine an interceptor chain corresponding to the network request interceptor according to the default interceptor list.
[0040] Optionally, the apparatus further comprises:
[0041] a receiving module, configured to receive a response result of the network request according to the network request interceptor;
[0042] a reverse processing module, configured to perform reverse recursive processing on the response result of the network request according to a plurality of custom interceptors included in the interceptor chain;
[0043] a transmission module, configured to transmit the reverse recursive processing result of the response result to an initiator of the network request.
[0044] Optionally, the apparatus further comprises: a storage module, configured to store the recursive processing results generated by each interceptor along the interceptor chain to the next interceptor except for the last interceptor in the recursive processing process;
[0045] The apparatus further comprises: an obtaining module, configured to obtain a target recursive processing result stored in the target interceptor in response to detecting that the reverse recursive processing of the target interceptor fails; a reprocessing module, configured to perform recursive processing on the target recursive processing result along the interceptor chain starting from the target interceptor to obtain a retry processing result of the network request; a resending module, configured to send the retry processing result to a corresponding server according to the network request interceptor to obtain a retry response result of the network request.
[0046] Optionally, the apparatus further comprises:
[0047] a generating module, configured to generate a corresponding target network request implementation class in response to receiving a target network request implementation solution, perform global storage on the target network request implementation class, and use the target network request implementation class as a network request interceptor corresponding to the target network request implementation solution.
[0048] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, comprising:
[0049] one or more processors;
[0050] a storage device, configured to store one or more programs,
[0051] when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of the above embodiments.
[0052] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method according to any one of the above embodiments is implemented.
[0053] One embodiment of the above invention has the following advantages or beneficial effects: By determining a network request interceptor based on a network request implementation solution and using the network request interceptor to send the processed network request to the server, it is possible to decouple the network request from the interceptors in the network request library, initiate network requests more flexibly, and reduce R & D costs and maintenance costs; Using an external interceptor chain to process the data of the network request and then passing the network request after data processing to the network request interceptor can improve data processing efficiency and flexibility and meet different data processing requirements; In the case where the interceptor list is not determined, using the default interceptor list can provide basic data processing functions for network requests, be compatible with the old business logic of network requests, and improve the scalability of network request processing; Receiving the response result and performing mirror reverse recursive processing on the response result can quickly and accurately obtain the response result and meet different response result processing requirements; Starting from the target interceptor and reprocessing the network request can achieve fixed-point retry of the network request, save system resources, improve the initiation efficiency of network requests, and avoid repeating the complete network request initiation process.
[0054] The further effects of the above non-conventional optional methods will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:
[0056] Figure 1 is a schematic diagram of the main process of the method for processing network requests according to an embodiment of the present invention;
[0057] Figure 2 is a schematic diagram of the main process of determining an interceptor chain according to a reference embodiment of the present invention;
[0058] Figure 3 is a schematic diagram of the overall process of initiating a network request according to a reference embodiment of the present invention;
[0059] Figure 4 is a schematic diagram of the main process of reinitiating a network request according to a reference embodiment of the present invention;
[0060] Figure 5 is a schematic diagram of the main process of the method for processing network requests according to a reference embodiment of the present invention;
[0061] Figure 6 is a schematic diagram of the main process of the method for processing network requests according to another reference embodiment of the present invention;
[0062] Figure 7Schematic diagram of the main modules of a network request processing device according to an embodiment of the present invention;
[0063] Figure 8 Exemplary system architecture diagram to which an embodiment of the present invention can be applied;
[0064] Figure 9 Schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. Detailed implementation manners
[0065] The following describes exemplary embodiments of the present invention with reference to the accompanying drawings. Various details of the embodiments of the present invention are included to facilitate understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0066] It should be noted that in the technical solution of the present invention, the processing of collection, use, storage, sharing, and transfer of user personal information complies with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the consent or authorization of the user. When applicable, technical processing such as de-identification and / or anonymization and / or encryption is performed on the user personal information.
[0067] An application can initiate a network request to a server, obtain data from the server, and display it on the front-end page. Usually, a pre-packaged network request library is used in the application to initiate a network request to the server. For example, during the cross-platform development of Flutter on mobile devices, developers usually choose the Dio library provided by a third party to implement the function of the application initiating a network request. The network request library is coupled with the business logic of initiating a network request and can provide various HTTP request methods such as GET, POST, and DELETE. Among them, the HTTP (HyperText Transfer Protocol) request method is a request method that conforms to the hypertext transfer protocol. Specifically, the GET request method is used to request specified page information and return the request result, the POST request method is used to submit data to a specified resource for processing requests, and the DELETE request method is used to request the server to delete specified page information.
[0068] Since the network request library is coupled with the business logic, when the business logic is updated or replaced with another network request library, a large amount of business code needs to be modified, resulting in high R & D costs and maintenance costs.
[0069] In view of this, according to the first aspect of the embodiments of the present invention, a method for processing network requests is provided.
[0070] Figure 1 It is a schematic diagram of the main process of the method for processing network requests according to an embodiment of the present invention. As Figure 1 shown, the method for processing network requests according to an embodiment of the present invention mainly includes the following steps S101 to S103.
[0071] Step S101, in response to receiving a network request, determine the corresponding network request implementation solution, and determine the corresponding network request interceptor according to the network request implementation solution.
[0072] The execution subject of the embodiment of the present invention receives a network request initiated by an application program. For example, the application program has a multi-layer structure inside, including: a service layer, a logic layer, a basic layer, etc. Among them, the service layer includes service logics related to various requests and is used for interacting with the front end. The logic layer includes a large number of service logics and is used for processing service data. The basic layer is used for storing service data, method protocols, etc. The network request is initiated by the service layer. The initiated network requests include: requests for obtaining data, requests for downloading files, requests for rendering pages, requests for uploading pictures, etc.
[0073] The execution subject of the embodiment of the present invention parses the received network request to determine the corresponding network request implementation solution. The network request implementation solution is a standard method for initiating a network request. For example, network request methods include: GET method, POST method, DOWNLOAD method, etc. A corresponding network request implementation solution is set for each network request method. The network request implementation solution is a network request protocol between the application program and the server. The network request implementation solution includes: the type of network request method (for example, GET, POST, DOWNLOAD, etc.), the regulations on the method input parameter object and the method output parameter object (for example, the data type of the input parameter object, the input parameter object that must be present when initiating a network request, and the optional input parameter object), whether to enhance the network request method (for example, execute an enhancement method before or after executing the network request method to enhance the function of the network request method), etc.
[0074] Multiple network request implementation solutions are preset in advance. Each network request implementation solution corresponds to a network request interceptor. The network request interceptor is used to intercept network requests in the application program, call the network request method specified in the network request implementation solution, and send the network request to the corresponding server.
[0075] Exemplarily, a corresponding scheme code is set for each network request implementation solution. The execution entity of the embodiment of the present invention parses the received network request, determines the target scheme code carried by the network request, and then queries the corresponding target network request implementation solution in the network request implementation solution set according to the target scheme code, and obtains the network request interceptor corresponding to the target network request implementation solution.
[0076] Abstracting the network request process through the network request implementation solution can encapsulate data and methods related to the network request in the network request implementation solution; determining the corresponding network request implementation solution according to the network request can decouple the network request from the fixed network request library, initiate the network request flexibly, and reduce the R & D cost and maintenance cost of initiating the network request.
[0077] According to a reference embodiment of the present invention, before receiving the network request, the method further includes: in response to receiving the target network request implementation solution, generating a corresponding target network request implementation class. Specifically, during the process of updating and iterating the business logic of the network request, if the user hopes to add a new network request implementation solution and replace the existing network request implementation solution, the user sends the target network request implementation solution to the execution entity of the embodiment of the present invention. The execution entity of the embodiment of the present invention registers the received target network request implementation solution to the business layer of the application program, and then generates a target network request implementation class according to the target network request implementation solution. The network request implementation class is registered to the basic layer of the application program, and the target network request implementation class is globally stored in the basic layer, and the target network request implementation class is used as the network request interceptor corresponding to the target network request implementation solution. The target network request implementation class has a network request method, a method input parameter object, an enhanced method of the network request method, etc., and is used to initiate a network request to the server.
[0078] Exemplarily, after restarting the application program, the execution entity of the embodiment of the present invention detects the network request implementation solution configured in the configuration file. If it detects that the user has configured a new network request implementation solution, the newly configured network request implementation solution is used as the target network request implementation solution, the target network request implementation solution is registered to the business layer of the application program, a target network request implementation class corresponding to the target network request implementation solution is generated, and the target network request implementation class is globally stored in the basic layer.
[0079] Whenever it is necessary to update the business logic for initiating network requests, it is only necessary to register a new network request implementation solution in the business layer and store the corresponding network request implementation class in the basic layer to achieve the update of the business logic. This can improve the update efficiency of the business logic, reduce the R & D cost and maintenance cost, decouple the network request from a specific network request library, and avoid making a large number of modifications to the business logic of the network request. The global storage of the network request implementation class enables the network request implementation class to be used in various places of the application program, facilitating the flexible use of the network request implementation class to initiate network requests.
[0080] Step S102: Process the data of the network request and pass the network request after data processing to the network request interceptor.
[0081] After receiving a network request, the data of the network request is processed so that the network request after processing meets the network request standard specified by the network request implementation solution. The execution entity of the embodiment of the present invention determines the received network request according to the network request standard and processes the network request when the network request does not meet the network request standard. Specifically, the network request standard includes: the request address of the network request is stored in a pre-set request address set, the parameters of the network request include the parameters that must be carried, the parameters of the network request do not include the parameters that should not be carried, the data type, data length, and data content of the parameters of the network request meet the standard, etc. The data processing that can be performed on the network request includes: adding the parameters that must be carried to the network request, deleting the parameters that should not be carried, filling in the default value when the parameter value is empty, modifying the data type of the parameter, rounding the numerical parameter, adjusting the case of the English character parameter, adjusting the simplified and traditional forms of the Chinese character parameter, modifying the request address of the network request to the address stored in the request address set, modifying the protocol and port number of the network request. The network request after data processing meets the network request standard specified by the network request implementation solution, and the network request after data processing is passed to the network request interceptor, and the network request interceptor sends the network request after data processing.
[0082] Exemplarily, the network request received by the execution subject of the embodiment of the present invention is "http: / / a1.a2.a3 / querydata?a4=b1". According to the network request standard specified by the network request implementation solution, the received network request is judged, and the following judgment results are obtained: the protocol "http" of the network request should be modified to "https", the request address "a1.a2.a3" of the network request should be modified to "a1.a2", the request method "querydata" of the network request should be modified to "queryData", and the network request lacks the necessary parameter "a5" (default value is b2); according to the above judgment results, the received network request is processed, and the network request after data processing is "https: / / a1.a2 / queryData?a4=b1&a5=b2".
[0083] Before sending the network request, processing the network request according to the network request standard specified by the network request implementation solution can make the network request after data processing meet the network request standard, improve the initiation efficiency and success rate of the network request, avoid repeated initiation of the network request, and save system resources.
[0084] According to a reference embodiment of the present invention, when processing the network request and passing the network request after data processing to the network request interceptor, first determine the interceptor chain corresponding to the network request interceptor. The interceptor chain is used to process the network request. The execution subject of the embodiment of the present invention converges the data processing logic of the network request in the interceptor chain, and the interceptor chain can be reused in the processing of multiple network requests. The interceptor chain corresponding to the network request interceptor can be one or more. Each interceptor chain includes multiple custom interceptors, and each custom interceptor includes one or more network request standards. For example, multiple interceptor chains are set in advance according to the business field of the network request. Each business field corresponds to one or more interceptor chains. After receiving the network request, determine the business field corresponding to the network request, and then determine the interceptor chain for processing the network request according to the business field. For another example, after receiving the network request, first judge the network request according to the network request standard, so as to determine the target data processing process to be executed on the network request. Each interceptor chain has a different data processing process. Splice the custom interceptors in the interceptor chain according to the target data processing process, so as to determine the interceptor chain for processing the network request.
[0085] After determining the interceptor chain for processing network requests, recursive processing of the network requests is performed according to the multiple custom interceptors included in the interceptor chain. Specifically, according to the arrangement order of the multiple custom interceptors in the interceptor chain, each custom interceptor is used to determine the network request according to one or more network request criteria included therein. In the case where the network request does not meet the network request criteria, corresponding data processing is performed on the network request, and then the network request after data processing is passed to the next custom interceptor arranged after the current custom interceptor, that is, the first custom interceptor in the interceptor chain processes the received network request, and the other custom interceptors in the interceptor chain perform data processing on the processing result of the previous custom interceptor. The above processing process is used as the recursive processing of the network request, and the processing result of the last custom interceptor in the interceptor chain is used as the recursive processing result of the network request. The recursive processing result of the network request is passed to the network request interceptor, and the network request interceptor processes the network request after data processing is sent.
[0086] Figure 2 It is a schematic diagram of the main process for determining the interceptor chain according to a reference embodiment of the present invention. Exemplarily, as Figure 2As shown in the figure, there are two ways to determine the interceptor chain. In the first way to determine the interceptor chain, the execution entity of the embodiment of the present invention identifies the business scenario or business domain from the network request. For example, the medical field, the e-commerce field, the financial field, the transportation field, etc. The identified business scenario or business domain is matched with multiple interceptor chains preset in the interceptor chain set. The interceptor chain set stores multiple interceptor chains, and each interceptor chain corresponds to a business scenario or business domain. For example, the rectangular interceptor chain applicable to the e-commerce scenario includes 3 rectangular custom interceptors, the circular interceptor chain applicable to the medical scenario includes 3 circular custom interceptors, and the triangular interceptor chain applicable to the financial scenario includes 3 triangular custom interceptors. In the case where the network request belongs to the e-commerce scenario, the rectangular interceptor chain is used to recursively process the network request. In the second way to determine the interceptor chain, the execution entity of the embodiment of the present invention identifies the data processing steps or data processing logic from the network request. For example, abnormal data cleaning, data format conversion, data truncation, data type conversion, data summation, data replacement, etc. The identified data processing steps or data processing logic are the target steps or target logic that need to be executed on the network request. The target steps or target logic are matched with multiple interceptor chains preset in the interceptor chain set. The interceptor chain set stores multiple interceptor chains, and each interceptor chain includes multiple custom interceptors. Each interceptor corresponds to a data processing step or data processing logic. The custom interceptors that match the target steps or target logic are combined according to the step execution order or logic execution order to obtain the interceptor chain corresponding to the network request.
[0087] In the prior art, the data processing logic of the network request is encapsulated in the network request library. The data processing logic in each network request library is fixed and cannot be compatible with multiple data processing logics. When switching the network request library, the data processing logic needs to be updated simultaneously, resulting in too high R & D costs and maintenance costs. The execution entity of the embodiment of the present invention uses an external interceptor chain to process the data of the network request, and then passes the network request after data processing to the network request interceptor, which can improve the data processing efficiency and flexibility, meet different data processing requirements, save system resources, and reduce R & D costs and maintenance costs.
[0088] According to another exemplary embodiment of the present invention, when determining the interceptor chain corresponding to the network request interceptor, first determine the interceptor code corresponding to the network request. Specifically, multiple interceptor chains are preset, and a corresponding interceptor code is set for each interceptor chain. Then, according to the interceptor code, determine the corresponding interceptor list; the interceptor list is used to store custom interceptors, and the interceptor list includes one or more custom interceptors. Then, according to the interceptor list, determine the corresponding custom interceptors, and combine the determined custom interceptors to obtain an interceptor chain, and use the combined interceptor chain as the interceptor chain corresponding to the network request interceptor, so as to determine the interceptor chain corresponding to the network request interceptor.
[0089] It should be noted that the interceptor list is configurable. Exemplarily, an interface for receiving the global interceptor list is preset at the basic layer of the application program. The execution entity of the embodiment of the present invention sets the global interceptor list according to the above interface. The global interceptor list is a commonly used interceptor list including data processing logic in the application program. Commonly used data processing logics include: data type conversion, data length adjustment, data content modification, and so on. The execution entity of the embodiment of the present invention configures requests according to the received list, such as adding a new interceptor list, deleting an existing interceptor list, deleting an existing interceptor list, adding or deleting custom interceptors in the interceptor list, and so on.
[0090] Again exemplarily, 3 interceptor lists are preset, including: interceptor list C1 (interceptor code is ljq001), interceptor list C2 (interceptor code is ljq002), interceptor list C3 (interceptor code is ljq003); the execution entity of the embodiment of the present invention parses the network request and obtains the target interceptor code as ljq002, then determines that the interceptor list corresponding to the network request is interceptor list C2, and combines the custom interceptors included in interceptor list C2 into an interceptor chain for performing data processing on the network request.
[0091] Using the interceptor code and interceptor list to determine the interceptor chain can more flexibly determine the interceptor chain applicable to the network request, more accurately perform data processing on the network request, meet different data processing requirements, and improve the scalability of the interceptor chain.
[0092] According to another referenceable embodiment of the present invention, in the case where the interceptor code corresponding to the network request is not determined, the method further includes: determining a default interceptor list corresponding to the network request interceptor. A default interceptor list is set for each network request interceptor in advance, and the default interceptor list includes one or more custom interceptors. According to the default interceptor list, determine the interceptor chain corresponding to the network request interceptor. Specifically, combine the custom interceptors included in the default interceptor list to obtain an interceptor chain, and use the combined interceptor chain as the interceptor chain corresponding to the network request interceptor.
[0093] Exemplarily, the execution subject of the embodiment of the present invention parses the network request. In the case where the interceptor code is not obtained (that is, the network request does not carry the interceptor code), or the obtained interceptor code does not conform to the pre-set code range, it is determined that the interceptor code corresponding to the network request is not determined; then, find the default interceptor list corresponding to the network request interceptor, determine the custom interceptors included in the default interceptor list, combine the custom interceptors included in the default interceptor list to obtain the default interceptor chain corresponding to the default interceptor list, and use the default interceptor chain as the interceptor chain corresponding to the network request. For example, set some old data processing logics in the custom interceptors included in the default interceptor list, so that the execution subject of the embodiment of the present invention can process the network request according to the previous data processing logics.
[0094] In the case where the interceptor list is not determined, using the default interceptor list can provide basic data processing functions for network requests, be compatible with the old business logics of network requests, and improve the scalability of network request processing.
[0095] Step S103, according to the network request interceptor, send the network request after data processing to the corresponding server.
[0096] The execution subject of the embodiment of the present invention parses the network request to determine the server corresponding to the network request. This server is used to respond to the network request and generate a response result for the network request. After completing the data processing of the network request, send the network request after data processing to the network request interceptor, and the network request interceptor sends the network request after data processing to the corresponding server.
[0097] Exemplarily, the execution subject of the embodiment of the present invention parses the network request to obtain the network address of the server, or obtains the server code of the server, searches in the pre-set configuration information for the server corresponding to the server code and its network address. After determining the network address of the server, use the network request interceptor to send the network request after data processing to the network address of the server.
[0098] Determine the network address of the server according to the network request, and use the network request interceptor to send the processed network request to the server, which can initiate network requests more flexibly, decouple the network request from the server, and reduce the R & D cost and maintenance cost.
[0099] According to a reference embodiment of the present invention, the method further includes: receiving the response result of the network request according to the network request interceptor. Specifically, after the server receives the network request after data processing, it processes the network request to generate a corresponding response result. For example, when the network request is used to query data, the response result includes: status code, whether the execution is successful, the data queried or the exception captured, etc. The execution entity of the embodiment of the present invention uses the network interceptor to receive the response result of the network request, and after monitoring that the network request has received the response result, obtains the response result of the network request. Then, according to the multiple custom interceptors included in the interceptor chain, reverse recursive processing is performed on the response result of the network request. For example, when the recursive processing of the network request performs data processing in the order from the first custom interceptor to the last custom interceptor, the reverse recursive processing of the response result performs data processing in the order from the last custom interceptor to the first custom interceptor. Then, the reverse recursive processing result of the response result is passed to the initiator of the network request.
[0100] Exemplarily, the execution entity of the embodiment of the present invention uses the interceptor chain D to process the data of the network request. Specifically, the interceptor chain D includes: custom interceptor D1, custom interceptor D2, and custom interceptor D3. The network request is processed in the above order to obtain the recursive processing result of the network request, and the processed network request (i.e., the recursive processing result of the network request) is sent to the server using the network request interceptor; after receiving the response result returned by the server, the execution entity of the embodiment of the present invention uses the interceptor chain D to process the data of the response result. Specifically, the response result is processed in the order of custom interceptor D3, custom interceptor D2, and custom interceptor D1 to obtain the reverse recursive processing result of the response result; the processed response result (i.e., the reverse recursive processing result of the response result) is sent to the initiator of the network request. It should be noted that the interceptor chain for performing recursive processing and the interceptor chain for performing reverse recursive processing can be the same interceptor chain or different interceptor chains. When determining whether the recursive processing result is the reverse recursive processing result, only the forward recursive direction and the reverse recursive direction of the interceptor chain need to be specified in advance.
[0101] Receiving the response result and performing mirror reverse recursive processing on the response result can quickly and accurately obtain the response result and meet different response result processing requirements.
[0102] According to another referenceable embodiment of the present invention, after recursively processing a network request according to a plurality of custom interceptors included in an interceptor chain, the method further includes: storing the recursive processing results generated by each interceptor along the interceptor chain to the next interceptor except for the last interceptor in the recursive processing process.
[0103] Exemplarily, use the interceptor chain F to recursively process the network request E1. Specifically, the interceptor chain F includes: the custom interceptor F1, the custom interceptor F2, and the custom interceptor F3; use the custom interceptor F1 to process the data of the network request E1 to obtain the network request E2 after data processing, and store the network request E2 to the custom interceptor F2; use the custom interceptor F2 to process the data of the network request E2 to obtain the network request E3 after data processing, and store the network request E3 to the custom interceptor F3; use the custom interceptor F3 to process the data of the network request E3 to obtain the network request E4 after data processing, and send the network request E4 to the network request interceptor, and the network request interceptor sends the network request E4 after completing data processing to the server.
[0104] After receiving the response result of the network request, the method further includes: in response to detecting that the reverse recursive processing of the target interceptor fails, obtaining the target recursive processing result stored in the target interceptor; starting from the target interceptor, recursively processing the target recursive processing result along the interceptor chain to obtain the retry processing result of the network request; according to the network request interceptor, sending the retry processing result to the corresponding server to obtain the retry response result of the network request.
[0105] Exemplarily, when performing reverse recursive processing on the response result of network request E4, it is monitored that the custom interceptor F3's reverse recursive processing is successful and the custom interceptor F2's reverse recursive processing fails. This indicates that there is a problem in the data processing of network request E2 by the custom interceptor F2. Therefore, obtain the network request E2 stored in the definition interceptor F2, reuse the custom interceptor F2 to perform data processing on the network request E2, obtain the network request E5 after re - data processing, store the network request E5 in the custom interceptor F3, use the custom interceptor F3 to perform data processing on the network request E5, obtain the network request E6 after data processing, send the network request E6 to the network request interceptor, and the network request interceptor sends the network request E6 after completing data processing to the server. It should be noted that the network request E3 sent to the server for the first time and the network request E6 sent to the server for the second time are both the recursive processing results of the network request E1, but the network request E6 is the recursive processing result after retry; then the execution entity of the embodiment of the present invention uses the network request interceptor to receive the response result of the network request E6 and continue to perform reverse recursive processing on the response result of the network request E6. If there is a situation where the reverse recursive processing fails, repeat the above steps until the reverse recursive processing is successful, and return the response result of the successful reverse recursive processing to the initiator of the network request E1.
[0106] Starting from the target interceptor and re - processing the network request can achieve fixed - point retry of the network request, save system resources, improve the initiation efficiency of the network request, and avoid repeating the complete network request initiation process.
[0107] Figure 3 It is a schematic diagram of the overall process of initiating a network request according to a reference embodiment of the present invention. Exemplarily, as Figure 3As shown in the figure, the application program includes: a business layer, a logic layer, and a basic layer. The execution entity of the embodiment of the present invention registers the received network request implementation solution in the business layer, and then abstracts the network request implementation solution into a network request implementation protocol in the basic layer to generate a network request implementation class; the execution entity of the embodiment of the present invention sets a global interceptor list in the business layer and stores it as the current global interceptor list in the basic layer; after receiving a network request, determine an interceptor list applicable to the network request according to the current global interceptor list. In the case where the interceptor list is not determined, use the default interceptor list; determine the network request implementation class corresponding to the network request, and use the determined network request implementation class as the network request interceptor. In the case where the network request implementation class is not determined, use the default network request implementation class as the network request interceptor of the network request; an interceptor chain, that is, multiple layers of custom interceptors, is set outside the network request interceptor. In the process of sending the network request to the network request interceptor, each custom interceptor is passed through in turn. Each custom interceptor processes the data of the network request. Finally, the network request that has been processed is sent to the network request interceptor, and the network request interceptor sends the network request that has been processed to the server and receives the response result returned by the server. Then, the response result is passed through each custom interceptor in turn. Each custom interceptor processes the data of the response result. Finally, the response result that has been processed is returned to the network request initiator.
[0108] Figure 4 It is a schematic diagram of the main process of reinitiating a network request according to a reference embodiment of the present invention. Exemplarily, as Figure 4 shown, the interceptor chain set outside the network request interceptor includes a custom interceptor 1 and a custom interceptor 2. First, the custom interceptor 1 processes the data of the network request 401, then the custom interceptor 2 processes the processing result of the custom interceptor 1 402, and then the network request interceptor sends the processing result of the custom interceptor 2 to the server and receives the response result returned by the server; then the custom interceptor 2 processes the response result 403. At this time, it is detected that the data processing 403 is not successful, indicating that there is a problem with the previous data processing 402 and it is necessary to re-initiate a network request to the server. Specifically, directly, the custom interceptor 2 processes the processing result of the custom interceptor 1 404, and then the network request interceptor sends the retry processing result of the custom interceptor 2 to the server and receives the secondary response result returned by the server; then the custom interceptor 2 processes the secondary response result 405, and then the custom interceptor 1 processes the processing result of the custom interceptor 2 406, and finally obtains the processed secondary response result.
[0109] Figure 5It is a schematic diagram of the main process of a method for processing network requests according to a reference embodiment of the present invention. As Figure 5 shown, the method for processing network requests may include:
[0110] Step S501, in response to receiving a network request, determine the corresponding network request implementation solution, and determine the corresponding network request interceptor according to the network request implementation solution;
[0111] Step S502, determine whether the network request carries an interceptor code. If so, jump to step S503; otherwise, jump to step S505;
[0112] Step S503, determine the interceptor code corresponding to the network request, and determine the corresponding interceptor list according to the interceptor code;
[0113] Step S504, determine the interceptor chain corresponding to the network request interceptor according to the interceptor list;
[0114] Step S505, determine the default interceptor list corresponding to the network request interceptor, and determine the interceptor chain corresponding to the network request according to the default interceptor list;
[0115] Step S506, recursively process the network request according to the multiple custom interceptors included in the interceptor chain;
[0116] Step S507, transfer the recursive processing result of the network request to the network request interceptor;
[0117] Step S508, send the network request after data processing to the corresponding server according to the network request interceptor.
[0118] The specific implementation content of the above method for processing network requests according to a reference embodiment of the present invention has been described in detail in the above method for processing network requests, so the repeated content will not be described here.
[0119] Figure 6 It is a schematic diagram of the main process of a method for processing network requests according to another reference embodiment of the present invention. As Figure 6 shown, the method for processing network requests may include:
[0120] Step S601, in response to receiving a network request, determine the corresponding network request implementation solution, and determine the corresponding network request interceptor according to the network request implementation solution;
[0121] Step S602, determine the interceptor chain corresponding to the network request interceptor, and recursively process the network request according to the multiple custom interceptors included in the interceptor chain;
[0122] Step S603: Transmit the recursive processing result of the network request to the network request interceptor;
[0123] Step S604: According to the network request interceptor, send the network request after data processing to the corresponding server;
[0124] Step S605: According to the network request interceptor, receive the response result of the network request;
[0125] Step S606: According to the multiple custom interceptors included in the interceptor chain, perform reverse recursive processing on the response result of the network request;
[0126] Step S607: Transmit the reverse recursive processing result of the response result to the network request initiator.
[0127] The specific implementation content of the above-mentioned processing method of the network request in another referenceable embodiment of the present invention has been described in detail in the above-mentioned processing method of the network request, so the repeated content will not be described here again.
[0128] According to the second aspect of the embodiments of the present invention, there is provided a processing device for network requests.
[0129] Figure 7 It is a schematic diagram of the main modules of the processing device for network requests according to the embodiments of the present invention. As Figure 7 shown, the processing device 700 for network requests mainly includes:
[0130] A determination module 701, configured to determine a corresponding network request implementation solution in response to receiving a network request, and determine a corresponding network request interceptor according to the network request implementation solution;
[0131] A processing module 702, configured to perform data processing on the network request, and transmit the network request after data processing to the network request interceptor;
[0132] A sending module 703, configured to send the network request after data processing to the corresponding server according to the network request interceptor.
[0133] According to a referenceable embodiment of the present invention, performing data processing on the network request and transmitting the network request after data processing to the network request interceptor includes:
[0134] Determine the interceptor chain corresponding to the network request interceptor, and perform recursive processing on the network request according to the multiple custom interceptors included in the interceptor chain;
[0135] Transmit the recursive processing result of the network request to the network request interceptor.
[0136] According to another referenceable embodiment of the present invention, determining the interceptor chain corresponding to the network request interceptor includes:
[0137] Determine the interceptor code corresponding to the network request, and determine the corresponding interceptor list according to the interceptor code;
[0138] Determine the interceptor chain corresponding to the network request interceptor according to the interceptor list.
[0139] According to yet another referenceable embodiment of the present invention, the processing device 700 for the network request further includes:
[0140] A second determination module, configured to determine the default interceptor list corresponding to the network request interceptor;
[0141] A third determination module, configured to determine the interceptor chain corresponding to the network request interceptor according to the default interceptor list.
[0142] According to still another referenceable embodiment of the present invention, the processing device 700 for the network request further includes:
[0143] A receiving module, configured to receive the response result of the network request according to the network request interceptor;
[0144] A reverse processing module, configured to perform reverse recursive processing on the response result of the network request according to a plurality of custom interceptors included in the interceptor chain;
[0145] A transmission module, configured to transmit the reverse recursive processing result of the response result to the initiator of the network request.
[0146] According to yet another referenceable embodiment of the present invention, the processing device 700 for the network request further includes: a storage module, configured to store the recursive processing results generated by each interceptor along the interceptor chain to the next interceptor except for the last interceptor in the recursive processing process;
[0147] The processing device 700 for the network request further includes: an acquisition module, configured to, in response to detecting that the reverse recursive processing of the target interceptor fails, acquire the target recursive processing result stored in the target interceptor; a reprocessing module, configured to start from the target interceptor and perform recursive processing on the target recursive processing result along the interceptor chain to obtain the retry processing result of the network request; a resending module, configured to send the retry processing result to the corresponding server according to the network request interceptor to obtain the retry response result of the network request.
[0148] According to a referenceable embodiment of the present invention, the processing device 700 for the network request further includes:
[0149] A generation module, configured to generate a corresponding target network request implementation class in response to receiving a target network request implementation solution, globally store the target network request implementation class, and use the target network request implementation class as a network request interceptor corresponding to the target network request implementation solution.
[0150] It should be noted that the specific implementation content of the network request processing device in the embodiments of the present invention has been described in detail in the above-mentioned network request processing method, so the repeated content will not be described here.
[0151] According to the technical solution of the embodiment of the present invention, determining a network request interceptor based on a network request implementation solution and using the network request interceptor to send the processed network request to the server can decouple the network request from the interceptors in the network request library, initiate network requests more flexibly, and reduce R & D costs and maintenance costs; using an external interceptor chain to process data for the network request and then passing the network request after data processing to the network request interceptor can improve data processing efficiency and flexibility and meet different data processing requirements; using a default interceptor list when the interceptor list is not determined can provide basic data processing functions for network requests, be compatible with the old business logic of network requests, and improve the scalability of network request processing; receiving a response result and performing mirror reverse recursive processing on the response result can quickly and accurately obtain the response result and meet different response result processing requirements; reprocessing the network request starting from the target interceptor can achieve fixed-point retry of network requests, save system resources, improve the initiation efficiency of network requests, and avoid repeating the complete network request initiation process.
[0152] According to a third aspect of the embodiments of the present invention, there is provided an electronic device, including: one or more processors; a storage device configured to store one or more programs, and when the one or more programs are executed by the one or more processors, enable the one or more processors to implement the method provided in the first aspect of the embodiments of the present invention.
[0153] According to a fourth aspect of the embodiments of the present invention, there is provided a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method provided in the first aspect of the embodiments of the present invention is implemented.
[0154] Figure 8 An exemplary system architecture 800 to which the network request processing method or network request processing device of the embodiments of the present invention can be applied is shown.
[0155] As Figure 8As shown, the system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. The network 804 is used to provide a medium for communication links between the terminal devices 801, 802, 803 and the server 805. The network 804 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0156] Users can use the terminal devices 801, 802, 803 to interact with the server 805 via the network 804 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 801, 802, 803, such as network request initiation applications, response result processing applications, search applications, instant messaging tools, email clients, social platform software, etc. (for example only).
[0157] The terminal devices 801, 802, 803 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop computers, and desktop computers, etc.
[0158] The server 805 may be a server providing various services, such as a background management server (for example only) that supports processing requests for network requests sent by the upstream using the terminal devices 801, 802, 803. The background management server may, in response to receiving a network request, determine a corresponding network request implementation solution, determine a corresponding network request interceptor according to the network request implementation solution; perform data processing on the network request, pass the network request after data processing to the network request interceptor; according to the network request interceptor, send the network request after data processing to the corresponding server; and feedback the processing situation of the network request (for example only) to the terminal device.
[0159] It should be noted that the network request processing method provided by the embodiments of the present invention is generally executed by the server 805. Correspondingly, the network request processing device is generally arranged in the server 805. The network request processing method provided by the embodiments of the present invention may also be executed by the terminal devices 801, 802, 803. Correspondingly, the network request processing device may be arranged in the terminal devices 801, 802, 803.
[0160] It should be understood that Figure 8 the numbers of terminal devices, networks, and servers in
[0161] are merely illustrative. According to the implementation requirements, there may be any number of terminal devices, networks, and servers. Figure 9 Shown below is a schematic structural diagram of a computer system 900 of a terminal device suitable for implementing the embodiments of the present invention. Figure 9The terminal device shown is only an example and should not impose any limitations on the functions and usage scope of the embodiments of the present invention.
[0162] As Figure 9 shown, computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage section 908 into the random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, ROM 902, and RAM 903 are connected to each other via a bus 904. The input / output (I / O) interface 905 is also connected to the bus 904.
[0163] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as required. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as required so that the computer program read from it can be installed into the storage section 908 as required.
[0164] Specifically, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program contains program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above functions defined in the system of the embodiments of the present invention are executed.
[0165] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments of the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in combination with an instruction execution system, apparatus, or device. In the embodiments of the present invention, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable medium can send, propagate, or transmit a program for use by or in combination with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0166] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer programs according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the above module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0167] The modules involved in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes a determination module, a processing module, and a sending module. In some cases, the names of these modules do not constitute a limitation on the module itself. For example, the determination module can also be described as "the module for determining the network request interceptor".
[0168] As another aspect, an embodiment of the present invention further provides a computer-readable medium. The computer-readable medium can be included in the device described in the above embodiment; or it can exist alone without being assembled into the device. The above computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device implements the following method: in response to receiving a network request, determining a corresponding network request implementation solution, and determining a corresponding network request interceptor according to the network request implementation solution; performing data processing on the network request, and delivering the network request after data processing to the network request interceptor; and sending the network request after data processing to a corresponding server according to the network request interceptor.
[0169] According to the technical solution of the embodiment of the present invention, determining a network request interceptor based on a network request implementation solution and using the network request interceptor to send the processed network request to the server can decouple the network request from the interceptors in the network request library, initiate network requests more flexibly, and reduce the R & D cost and maintenance cost; using an external interceptor chain to perform data processing on the network request and then delivering the network request after data processing to the network request interceptor can improve the data processing efficiency and flexibility and meet different data processing requirements; using a default interceptor list when the interceptor list has not been determined can provide basic data processing functions for network requests, be compatible with the old business logic of network requests, and improve the scalability of network request processing; receiving a response result and performing mirror reverse recursive processing on the response result can quickly and accurately obtain the response result and meet different response result processing requirements; starting from the target interceptor and reprocessing the network request can implement fixed-point retry of network requests, save system resources, improve the initiation efficiency of network requests, and avoid repeating the entire network request initiation process.
[0170] The above specific embodiments do not constitute a limitation on the protection scope of the embodiments of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the embodiments of the present invention should be included within the protection scope of the embodiments of the present invention.
Claims
1. A method for processing network requests, characterized in that, Including: In response to receiving a network request, determining a corresponding network request implementation solution, and determining a corresponding network request interceptor according to the network request implementation solution; Performing data processing on the network request, and passing the network request after data processing to the network request interceptor; Sending the network request after data processing to a corresponding server according to the network request interceptor.
2. The method according to claim 1, characterized in that, Performing data processing on the network request, and passing the network request after data processing to the network request interceptor, including: Determining an interceptor chain corresponding to the network request interceptor, and performing recursive processing on the network request according to a plurality of custom interceptors included in the interceptor chain; Passing the recursive processing result of the network request to the network request interceptor.
3. The method according to claim 2, wherein Determining an interceptor chain corresponding to the network request interceptor, including: Determining an interceptor code corresponding to the network request, and determining a corresponding interceptor list according to the interceptor code; Determining an interceptor chain corresponding to the network request interceptor according to the interceptor list.
4. The method according to claim 3, characterized in that, In the case where the interceptor code corresponding to the network request is not determined, the method further includes: Determining a default interceptor list corresponding to the network request interceptor; Determining an interceptor chain corresponding to the network request interceptor according to the default interceptor list.
5. The method according to claim 2, wherein The method further includes: Receiving a response result of the network request according to the network request interceptor; Performing reverse recursive processing on the response result of the network request according to a plurality of custom interceptors included in the interceptor chain; Passing the reverse recursive processing result of the response result to the initiator of the network request.
6. The method according to claim 5, characterized in that, After performing recursive processing on the network request according to a plurality of custom interceptors included in the interceptor chain, the method further includes: storing the recursive processing result generated by each interceptor along the interceptor chain to the next interceptor except the last interceptor in the recursive processing process; After receiving the response result of the network request, the method further includes: in response to detecting that the reverse recursive processing of the target interceptor fails, obtaining a target recursive processing result stored in the target interceptor; starting from the target interceptor, performing recursive processing on the target recursive processing result along the interceptor chain to obtain a retry processing result of the network request; sending the retry processing result to a corresponding server according to the network request interceptor, and obtaining a retry response result of the network request.
7. The method according to claim 1, characterized in that, Before receiving a network request, the method further includes: In response to receiving a target network request implementation solution, generating a corresponding target network request implementation class, globally storing the target network request implementation class, and using the target network request implementation class as a network request interceptor corresponding to the target network request implementation solution.
8. A processing device for network requests, characterized in that, Including: A determining module, configured to, in response to receiving a network request, determine a corresponding network request implementation solution, and determine a corresponding network request interceptor according to the network request implementation solution; A processing module, configured to process data of the network request and transfer the network request after data processing to the network request interceptor; A sending module, configured to send the network request after data processing to a corresponding server according to the network request interceptor.
9. An electronic device, characterized in that, Comprising: One or more processors; A storage device, configured to store one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1-7.
10. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, the method according to any one of claims 1-7 is implemented.