CN115062254A - Mock data implementation method based on Google browser, storage medium and equipment - Google Patents

Mock data implementation method based on Google browser, storage medium and equipment Download PDF

Info

Publication number
CN115062254A
CN115062254A CN202210743344.6A CN202210743344A CN115062254A CN 115062254 A CN115062254 A CN 115062254A CN 202210743344 A CN202210743344 A CN 202210743344A CN 115062254 A CN115062254 A CN 115062254A
Authority
CN
China
Prior art keywords
data
mock
acquisition request
request
data acquisition
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
CN202210743344.6A
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.)
Shenzhen Yishi Huolala Technology Co Ltd
Original Assignee
Shenzhen Yishi Huolala 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 Shenzhen Yishi Huolala Technology Co Ltd filed Critical Shenzhen Yishi Huolala Technology Co Ltd
Priority to CN202210743344.6A priority Critical patent/CN115062254A/en
Publication of CN115062254A publication Critical patent/CN115062254A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a mock data implementation method based on a Google browser, which comprises the following steps: receiving a data acquisition request initiated from a web page; triggering a network request method preset in a Google browser to rewrite script execution, and searching relevant data of pre-configured mock data from a local storage space of the Google browser; judging whether mock data related data and the data acquisition request meet preset matching conditions or not; if so, intercepting the data acquisition request and returning response data in mock data related data meeting preset matching conditions to a web page; if not, sending the data acquisition request to the server side so that the server side returns the data corresponding to the data acquisition request to the web page. The method realizes the mock function, can solve the problem of front-end and back-end separation development, can quickly simulate data with various possibilities in a development stage through mock data related data configuration, avoids the bug repairing problem of later-stage edge abnormity, and obviously improves the front-end development efficiency.

Description

Mock data implementation method based on Google browser, storage medium and equipment
Technical Field
The invention relates to the technical field of front-end and back-end development, in particular to a mock data implementation method and device based on a Google browser, a computer readable storage medium and computer equipment.
Background
In the process of project development, front-end and back-end separation development is generally carried out, the front end and the back end are developed simultaneously by two lines, and the front-end development depends on back-end return data.
At present, when development involves data return from a server, a front-end developer mainly provides data required by front-end development by mock data in code or locally starting a mock data service. However, for the front-end and back-end separated development, the front-end service obtains the data of the server through the API in advance, so that the whole development efficiency of the front-end is not high; in the development stage, the server cannot rapidly simulate data with various possibilities, and the problem of bug repair of edge abnormality in the later stage is increased. Therefore, a method for expanding mock data is needed to avoid a series of problems that the development efficiency is affected, such as difficulty in simulation and time consumption of joint debugging, of the mock data edge.
Disclosure of Invention
In order to solve at least one of the above technical defects, the present invention provides a mock data implementation method based on google browser, and a corresponding apparatus, computer readable storage medium and computer device.
According to an aspect, an embodiment of the present invention provides a mock data implementation method based on a google browser, including the following steps:
receiving a data acquisition request initiated from a web page;
triggering a network request method preset in a Google browser to rewrite script execution, and searching relevant data of pre-configured mock data from a local storage space of the Google browser;
judging whether mock data related data and the data acquisition request meet preset matching conditions or not;
if so, intercepting the data acquisition request and returning response data in mock data related data meeting preset matching conditions to the web page;
if not, the data acquisition request is sent to the server side, so that the server side returns data corresponding to the data acquisition request to the web page.
Preferably, the mock data related data includes a domain name, a url address, a request method, and response data.
Preferably, the determining whether there is mock data related data and the data obtaining request meeting a preset matching condition includes:
and judging whether the domain name, the url address and the request method in the mock data related data are consistent with the data configuration requirement of the data acquisition request.
Preferably, the options of the request method include a POST method, a DELETE method, a PUT method, and a GET method.
Preferably, the mock data related data further comprises a valid or invalid item;
before the receiving of the data acquisition request initiated from the web page, the method further includes:
and selecting whether to open the item which is effective or not in a visual developer tool embedded in the Google browser so as to manage whether the data related to the pre-configured mock data is enabled or not.
Preferably, the web request method rewrite script is a proxy script for rewriting an original web request method fetch and/or XMLHttpRequest of the google browser.
Preferably, the mock data related data is preconfigured and/or managed through a visualization developer tool embedded in google browser.
In addition, according to another aspect, an embodiment of the present invention provides a mock data implementation apparatus based on google browser, including:
the request receiving module is used for receiving a data acquisition request initiated from a web page;
the searching module is used for triggering a network request method preset in the Google browser to rewrite the script execution and searching the pre-configured mock data related data from the local storage space of the Google browser;
the matching module is used for judging whether mock data related data and the data acquisition request meet preset matching conditions or not;
the mock function module is used for intercepting the data acquisition request and returning response data in mock data related data meeting a preset matching condition to the web page when the mock data related data and the data acquisition request meet the preset matching condition;
and the request server module is used for sending the data acquisition request to a server when no mock data related data and the data acquisition request meet a preset matching condition, so that the server returns data corresponding to the data acquisition request to the web page.
According to yet another aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the above-mentioned google browser-based mock data implementation method.
According to yet another aspect, embodiments of the present invention provide a computer device, the computer comprising one or more processors; a memory; one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more computer programs configured to: and executing the mock data implementation method based on the Google browser.
Compared with the prior art, the invention has the following beneficial effects:
according to the mock data implementation method, device, computer readable storage medium and computer equipment based on the Google browser, provided by the invention, scripts are rewritten by a network request method preset in the Google browser, mock data related data are configured in advance according to project research and development requirements so as to simulate server data responses under different conditions, after a data acquisition request initiated by a web page is received, mock data related data matched with the request or not is searched, and the response data configured in advance is returned to the web page during matching, so that a mock function is realized, the problem of front-end and back-end separate development can be solved, data with multiple possibilities can be simulated rapidly in a development stage through mock data related data configuration, the problem of repairing bug with abnormal edges at the later stage is avoided, and the front-end development efficiency is remarkably improved.
In addition, a visual developer tool is embedded in the Google browser, so that the configuration and the management of mock data related data can be simply and intuitively realized; furthermore, by embedding a visual developer tool and configuring whether the item is effective or not in the Google browser, whether the related data of mock data is enabled or not can be managed simply and intuitively; the problems that management of mock data related data is troublesome, data cannot be managed through a visual interface, and operation is complex are effectively solved.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a flowchart of a method for implementing mock data based on google browser according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a mock data implementation device based on a google browser according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
The embodiment of the invention provides a mock data implementation method based on a Google browser, which comprises the following steps of:
step S110: a data acquisition request originating from a web page is received.
In an actual application scenario of project research and development, when there is a need to acquire data required by front-end development from a server, a front-end developer sends a data acquisition request on a Web page.
Step S120: and triggering a network request method preset in the Google browser to rewrite script execution, and searching the pre-configured mock data related data from the local storage space of the Google browser.
In google browsers, the main links requested by their front-end networks are typically google browser web pages, fetch and/or XMLHttpRequest methods in google browsers, and communication between servers. Specifically, the web page initiates a data acquisition request, requests data from the server based on a fetch method and/or an XMLHttpRequest method, and the server returns response data, and realizes front-end data processing and returns to the web page based on the fetch method and/or the XMLHttpRequest method. Wherein fetch and XMLHttpRequest are both HTTP (Hyper Text Transfer Protocol) data request modes.
For the embodiment, on the basis of the conventional link, based on the function of inserting the script into the page provided by the google browser expansion, the network request method rewrite script is added in the web page of the google browser in advance to rewrite the network request method fetch and/or the XMLHttpRequest method of the web page in the google browser, so that a mock function can be realized, and the function of returning data to the web page by the server side is simulated.
In a possible implementation manner, a content-scripts content plug-in can easily inject js (javascript) and CSS (Cascading Style Sheets) into a specified page in a configuration manner, and is a form of injecting a script into a page in a google browser.
For this embodiment, at the time when the web page requests data from the server, that is, when a data acquisition request initiated from the web page is received, the execution of the network request method rewrite script is triggered, so that the conventional link is rewritten, and an operation of searching for mock data related data is started, so as to implement a mock function when a condition is satisfied, and simulate a function of returning data from the server to the web page.
For the embodiment, the mock data related data is pre-configured in the google browser, and the configured mock data related data is stored in a computer disk, specifically in a local storage space of the google browser.
The mock data refers to virtual data which simulates a server-side interface and is used for helping a front end and a back end to develop simultaneously, and the related data of the mock data refers to data related to implementation of the mock data.
In the embodiment, different mock data related data can be configured according to project development requirements, so that various server data responses can be simulated simply and quickly, the server data responses under different conditions can be simulated efficiently, and the stability of a project can be improved.
Step S130: and judging whether mock data related data and the data acquisition request meet preset matching conditions.
For this embodiment, each piece of configured mock data related data includes one or more data items, and in the process of searching for preconfigured mock data related data from the local storage space of the google browser, it needs to be determined whether the configured mock data related data matches a data acquisition request initiated by a web page, where the matching condition is whether the data item corresponding to the data acquisition request is consistent with the data item included in the mock data related data.
Step S140: and when the mock data related data and the data acquisition request meet the preset matching conditions, intercepting the data acquisition request and returning response data in the mock data related data meeting the preset matching conditions to the web page.
For the embodiment, if the mock data related data is matched with the data acquisition request, the data acquisition request is directly intercepted, and the response data in the mock data related data meeting the preset matching condition is returned to the web page, so that the mock function is realized, and the function of returning data to the web page by the server side is simulated.
Step S150: and when no mock data related data and the data acquisition request meet a preset matching condition, sending the data acquisition request to a server, so that the server returns data corresponding to the data acquisition request to the web page.
For the embodiment, if no mock data related data is matched with the data acquisition request, the operation of a conventional link is executed, data is requested from the server, and response data is returned to the web page by the server.
According to the implementation method of mock data based on the Google browser, provided by the invention, the script is rewritten by presetting a network request method in the Google browser, and relevant data of the mock data are configured in advance according to project research and development requirements so as to simulate data response of a server under different conditions, after a data acquisition request initiated by a web page is received, relevant data of the mock data matched with the request or not is searched, and the response data configured in advance is returned to the web page during matching, so that a mock function is realized, the problem of front-end and back-end separate development can be solved, data with various possibilities can be simulated rapidly in a development stage through configuration of the relevant data of the mock data, the problem of repairing the bug with abnormal edge at the later stage is avoided, and the development efficiency of the front end is obviously improved.
In some embodiments, the mock data-related data includes a domain name, a url address, a request method, and response data.
The request method refers to a requested action and is used for representing the operation on response data in the configured mock data related data. Generally, the request method comprises a method for performing incremental and destructive investigation on response data in mock data related data. And the response data is data returned by the simulation server when mock is realized.
In one possible implementation, the options of the request method include a POST method, a DELETE method, a PUT method, and a GET method.
The POST method is used for realizing the operation of newly adding data; the DELETE method is used for realizing the operation of deleting data; the PUT method is used for realizing data modification operation; the GET method is used for realizing data searching operation.
In some embodiments, the step S130 of determining whether there is mock data related data and the data obtaining request satisfy a preset matching condition includes: and judging whether the domain name, the url address and the request method in the mock data related data are consistent with the data configuration requirement of the data acquisition request.
For this embodiment, each piece of configured mock data related data includes information such as a domain name, a url address, and a request method, and in the process of searching for pre-configured mock data related data from the local storage space of the google browser, it needs to be determined whether the match is made with a data acquisition request initiated by a web page, where the matching condition is that whether a data item corresponding to a data configuration requirement of the data acquisition request is consistent with information such as a domain name, a url address, and a request method in the mock data related data.
For this embodiment, if there is information such as a domain name, a url address, and a request method in mock data related data that matches a data item corresponding to the data acquisition request, the data acquisition request is directly intercepted, and response data in the mock data related data that meets a preset matching condition is returned to the web page, so that a mock function is implemented, and a function of a simulation server returning data to the web page is implemented.
For this embodiment, if no information such as a domain name, a url address, and a request method in mock data related data matches with a data item corresponding to the data acquisition request, a conventional link operation is performed, data is requested from the server, and the server returns response data to the web page.
In some embodiments, the mock data related data is preconfigured and/or managed by a visualization developer tool embedded in google browser.
For the embodiment, a google browser is embedded with a visual developer tool devtools, and the visual developer tool is used for configuring and managing mock data related data, and specifically has the main functions of configuration of adding, deleting, modifying, checking, collecting, managing, opening, closing, simulating a production environment and the like for the mock data related data.
For this embodiment, the visualization developer tool may be pre-installed through the programmatic expansion function of google browser. In an actual application scene, the visual developer tool can be uploaded to Google market or packaged into an installation package for downloading, installation and use, so that the tool can be used after being opened, the front-end development efficiency is improved, and the development cost is reduced.
For the installation in Google market, the installation can be directly carried out.
For the installation through the installation package, the following operations are continuously performed: i. and opening a Google browser, and outputting a website in an address bar: chrome:// extensions into google plug-in area; opening developer mode in google plug-in area; and iii, after the developer mode is opened, clicking 'loading the decompressed extension program', loading files for downloading the decompressed installation package into the Google plug-in, and completing installation of the expansion tool.
For the embodiment, the mock data related data is pre-configured through a visual developer tool embedded in google browser.
And in an actual application scene, opening the visual developer tool on a corresponding web page according to the project development requirement. The visual developer tool is provided with a 'new' key for configuring the related data of the new mock data.
And in the visual developer tool, filling in mock data related data in a form and submitting to complete the configuration of the mock data related data.
For the embodiment, the mock data related data at least comprises a domain name, a url address, a request method and response data.
Specifically, the form in the visualization developer tool comprises a domain name, a domain field, a webpage address, a URL address field, a request method, a method field, a validation item, response data, a response item and an interface description item, and the configuration of mock data related data can be completed by filling and submitting the form.
For this embodiment, the mock data related data can also be managed by a visual developer tool embedded in google browser.
For the embodiment, each piece of configured mock data related data is displayed in the visualization developer tool in a form of a list or a form. The visualization developer tool is provided with options of editing, deleting, copying and the like for managing mock data related data.
In the embodiment, the visual developer tool is embedded in the Google browser, so that configuration and management of mock data related data can be simply and visually realized, and the problems that management of mock data related data is troublesome, data cannot be managed through a visual interface, and operation is complex are effectively solved.
In some embodiments, the mock data related data further comprises a validation item based on a domain name, a url address, a request method and response data, and the validation item can be applied to manage the mock data related data.
For this embodiment, the item of whether to take effect is used to control whether to enable or not when managing the mock data related data. Specifically, before the step S110 receives a data acquisition request initiated from a web page, whether configured mock data related data is enabled or not is managed in a visual developer tool embedded in a google browser, where each configured mock data related data is displayed in the visual developer tool in a form of a list or a form, and each mock data related data has an item which can be selectively opened or closed and is enabled or not, and whether preconfigured mock data related data is enabled or not is managed by selecting whether to open the item which is enabled or not.
In the embodiment, whether the mock data related data is enabled or not can be simply and intuitively managed by embedding a visual developer tool and configuring whether the item is effective or not in the Google browser, and the problems that the mock data related data is troublesome to manage, the data cannot be managed through a visual interface and the operation is complex are effectively solved.
In some embodiments, the web request method rewrite script is a proxy script for rewriting an original web request method fetch and/or XMLHttpRequest of the google browser.
In google browsers, the main link requested by the front-end network is generally the web page of the google browser, fetch and/or XMLHttpRequest methods in the google browser, and communication between the servers. Specifically, the web page initiates a data acquisition request, requests data from the server based on a fetch method and/or an XMLHttpRequest method, and the server returns response data, and realizes front-end data processing and returns to the web page based on the fetch method and/or the XMLHttpRequest method.
For the embodiment, on the basis of the conventional link, a proxy script, specifically a proxy JavaScript script, is inserted into a web page based on the function of expanding the provided script to the page by the google browser, and the proxy script is used for rewriting a network request method fetch and/or an XMLHttpRequest method in the google browser, so that a mock function can be realized, and a function of returning data to the web page by a simulation server is realized.
In a possible implementation manner, the method can realize that proxy scripts are easily injected into a specified page in a configuration manner based on content-scripts content plug-ins, and the content-scripts content plug-ins are a form of injecting scripts into the page in a Google browser.
For this embodiment, when a web page requests data from a server every time, that is, a data acquisition request initiated from the web page is received, the execution of the proxy script is triggered, so that a conventional link is rewritten, and an operation of searching for mock data related data is started, so as to implement a mock function when a condition is satisfied, and simulate a function of returning data from the server to the web page.
By inserting proxy scripts into a web page to rewrite a network request method fetch and/or an XMLHttpRequest method in a Google browser, the method can be understood that a network request interception layer is directly added to a web page layer and a server corresponding to a main link of a front-end network request, and by executing the proxy scripts, a data acquisition request matched with mock data related data can be intercepted, and response data in the corresponding mock data related data is returned to the web page, so that a mock function is realized, and the function of returning data to the web page by the server is simulated.
In addition, an embodiment of the present invention provides a mock data implementation apparatus based on a google browser, and as shown in fig. 2, the apparatus includes: the system comprises a request receiving module 21, a searching module 22, a matching module 23, a mock function module 24 and a request server module 25; wherein the content of the first and second substances,
the request receiving module 21 is configured to receive a data obtaining request initiated from a web page;
the searching module 22 is configured to trigger a network request method preset in the google browser to rewrite a script for execution, and search for pre-configured mock data related data from a local storage space of the google browser;
the matching module 23 is configured to determine whether there is mock data related data and the data acquisition request that meet a preset matching condition;
the mock functional module 24 is configured to, when there is mock data related data and the data acquisition request satisfy a preset matching condition, intercept the data acquisition request and return response data in the mock data related data that satisfy the preset matching condition to the web page;
the request server module 25 is configured to send the data acquisition request to the server when no mock data related data and the data acquisition request meet a preset matching condition, so that the server returns data corresponding to the data acquisition request to the web page.
Preferably, the mock data related data includes a domain name, a url address, a request method, and response data.
Preferably, the matching module 23 is specifically configured to:
and judging whether the domain name, the url address and the request method in the mock data related data are consistent with the data configuration requirement of the data acquisition request.
Preferably, the options of the request method include a POST method, a DELETE method, a PUT method, and a GET method.
Preferably, the mock data related data further comprises a valid or invalid item;
before the receiving of the data acquisition request initiated from the web page, the method further includes:
and selecting whether to open the item which is effective or not in a visual developer tool embedded in the Google browser so as to manage whether the data related to the pre-configured mock data is enabled or not.
Preferably, the web request method rewrite script is a proxy script for rewriting an original web request method fetch and/or XMLHttpRequest of the google browser.
Preferably, the mock data related data is preconfigured and/or managed through a visualization developer tool embedded in google browser.
The contents of the method embodiments of the present invention are all applicable to the apparatus embodiments, the functions specifically implemented by the apparatus embodiments are the same as those of the method embodiments, and the beneficial effects achieved by the apparatus embodiments are also the same as those achieved by the method described above, and for details, refer to the description of the method embodiments, and are not described herein again.
Furthermore, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the mock data implementation method based on google browser described in any of the above embodiments. The computer-readable storage medium includes, but is not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks, ROMs (Read-Only memories), RAMs (Random AcceSS memories), EPROMs (EraSable Programmable Read-Only memories), EEPROMs (Electrically EraSable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a storage device includes any medium that stores or transmits information in a form readable by a device (e.g., a computer, a cellular phone), and may be a read-only memory, a magnetic or optical disk, or the like.
The contents of the method embodiment of the present invention are all applicable to the embodiment of the storage medium, the functions specifically implemented by the embodiment of the storage medium are the same as those of the method embodiment described above, and the beneficial effects achieved by the embodiment of the storage medium are also the same as those achieved by the method described above.
In addition, an embodiment of the present invention further provides a computer device, where the computer device described in this embodiment may be a server, a personal computer, a network device, and other devices. The computer device includes: one or more processors, a memory, one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more computer programs configured to perform the google browser-based mock data implementation method of any of the above embodiments.
The contents of the method embodiment of the present invention are all applicable to the computer apparatus embodiment, the functions specifically implemented by the computer apparatus embodiment are the same as those of the method embodiment, and the beneficial effects achieved by the method embodiment are also the same as those achieved by the method.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A mock data implementation method based on Google browser is characterized by comprising the following steps:
receiving a data acquisition request initiated from a web page;
triggering a network request method preset in a Google browser to rewrite script execution, and searching relevant data of pre-configured mock data from a local storage space of the Google browser;
judging whether mock data related data and the data acquisition request meet preset matching conditions or not;
if so, intercepting the data acquisition request and returning response data in mock data related data meeting preset matching conditions to the web page;
if not, the data acquisition request is sent to the server side, so that the server side returns the data corresponding to the data acquisition request to the web page.
2. The mock data realization method according to claim 1, wherein said mock data related data comprises domain name, url address, request method and response data.
3. The mock data implementation method according to claim 2, wherein the determining whether there is mock data related data and the data acquisition request satisfying a preset matching condition comprises:
and judging whether the domain name, the url address and the request method in the mock data related data are consistent with the data configuration requirement of the data acquisition request.
4. The mock data realization method according to claim 2, wherein said options of request method include POST method, DELETE method, PUT method and GET method.
5. The mock data realization method according to claim 2, wherein said mock data related data further comprises a validation or not item;
before the receiving of the data acquisition request initiated from the web page, the method further includes:
and selecting whether to open the item which is effective or not in a visual developer tool embedded in the Google browser so as to manage whether the data related to the pre-configured mock data is enabled or not.
6. The mock data implementation method according to claim 1, wherein said web request method rewrite script is a proxy script for rewriting an original web request method fetch and/or XMLHttpRequest of a google browser.
7. The mock data implementation method according to claim 1, characterized in that said mock data related data is preconfigured and/or managed by a visualization developer tool embedded in google browser.
8. A mock data implementation device based on Google browser is characterized by comprising:
the request receiving module is used for receiving a data acquisition request initiated from a web page;
the searching module is used for triggering a network request method preset in the Google browser to rewrite the script execution and searching the pre-configured mock data related data from the local storage space of the Google browser;
the matching module is used for judging whether mock data related data and the data acquisition request meet preset matching conditions or not;
the mock function module is used for intercepting the data acquisition request and returning response data in mock data related data meeting a preset matching condition to the web page when the mock data related data and the data acquisition request meet the preset matching condition;
and the request server module is used for sending the data acquisition request to a server when no mock data related data and the data acquisition request meet a preset matching condition, so that the server returns data corresponding to the data acquisition request to the web page.
9. A computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when executed by a processor, the computer program implements the google browser-based mock data implementation method of any of claims 1 to 7.
10. A computer device, comprising:
one or more processors;
a memory;
one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more computer programs configured to: -executing the google browser based mock data implementation method according to any of the claims 1 to 7.
CN202210743344.6A 2022-06-28 2022-06-28 Mock data implementation method based on Google browser, storage medium and equipment Pending CN115062254A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210743344.6A CN115062254A (en) 2022-06-28 2022-06-28 Mock data implementation method based on Google browser, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210743344.6A CN115062254A (en) 2022-06-28 2022-06-28 Mock data implementation method based on Google browser, storage medium and equipment

Publications (1)

Publication Number Publication Date
CN115062254A true CN115062254A (en) 2022-09-16

Family

ID=83203937

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210743344.6A Pending CN115062254A (en) 2022-06-28 2022-06-28 Mock data implementation method based on Google browser, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN115062254A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117807346A (en) * 2024-03-01 2024-04-02 山东浪潮科学研究院有限公司 Front-end request mock tool based on browser

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117807346A (en) * 2024-03-01 2024-04-02 山东浪潮科学研究院有限公司 Front-end request mock tool based on browser

Similar Documents

Publication Publication Date Title
US10108595B2 (en) Method and system for automated analysis and transformation of web pages
CN105940654B (en) Franchise static web application in trust
CN102385594B (en) The kernel control method of multi-core browser and device
CN101539911B (en) Device and method for accelerating display of web page of browser
Aggarwal et al. An analysis of private browsing modes in modern browsers
CN106649395A (en) Webpage updating method and apparatus
CN108304498A (en) Webpage data acquiring method, device, computer equipment and storage medium
CN109408750A (en) Page display method, device, computer equipment and storage medium
WO2018129774A1 (en) Method and device for page processing
US10289743B2 (en) Client-side minimal download and simulated page navigation features
WO2022252637A1 (en) Browser-based rpa implementation method and apparatus, device, and medium
CN109522500B (en) Webpage display method, device, terminal and storage medium
CN108932332A (en) The loading method and device of static resource
CN111090452A (en) Service environment switching method and computer-readable storage medium
CN112637361A (en) Page proxy method, device, electronic equipment and storage medium
CN111431767B (en) Multi-browser resource synchronization method and device, computer equipment and storage medium
CN115062254A (en) Mock data implementation method based on Google browser, storage medium and equipment
Kelly et al. On the change in archivability of websites over time
Castiglione et al. The forensic analysis of a false digital alibi
CN114928484A (en) Honeypot generation method and device, electronic equipment and storage medium
CN112241298A (en) Page display method and device, storage medium and electronic device
CN111552643A (en) Multi-browser webpage access synchronization method and system
CN116521135A (en) Mock data return method, device, system and medium
CN115495372A (en) Analog data processing method, device, equipment and medium
CN109101429B (en) Method and device for debugging browser page of set top box

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