CN111752625A - Method and device for interface mock - Google Patents

Method and device for interface mock Download PDF

Info

Publication number
CN111752625A
CN111752625A CN202010578743.2A CN202010578743A CN111752625A CN 111752625 A CN111752625 A CN 111752625A CN 202010578743 A CN202010578743 A CN 202010578743A CN 111752625 A CN111752625 A CN 111752625A
Authority
CN
China
Prior art keywords
mock
terminal
return value
route
interface
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
CN202010578743.2A
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.)
JD Digital Technology Holdings Co Ltd
Original Assignee
JD Digital Technology Holdings 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 JD Digital Technology Holdings Co Ltd filed Critical JD Digital Technology Holdings Co Ltd
Priority to CN202010578743.2A priority Critical patent/CN111752625A/en
Publication of CN111752625A publication Critical patent/CN111752625A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/4401Bootstrapping
    • G06F9/4416Network booting; Remote initial program loading [RIPL]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse

Abstract

The embodiment of the disclosure discloses a method and a device for an interface mock. One embodiment of the method comprises: receiving a mock interface request sent by a terminal, wherein the mock interface request comprises a reference and a route break; checking whether a mock interface corresponding to the route failure exists or not; if a mock interface corresponding to route dropping exists, inquiring whether a return value matched with the entering parameter exists from preset configuration information; and if the return value matched with the access parameter exists, sending the matched return value to the terminal. The implementation mode reduces the technical threshold, improves the capability of the interface mock, is simple and strong, can be used more conveniently, and is suitable for more scenes.

Description

Method and device for interface mock
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a method and a device for interface mock.
Background
In actual development, if the back end of the network interface is not provided, the front end personnel needs to forge the data by themselves.
The interfaces mock on the market are various at present, but in the process of implementing the invention, the inventor finds that the following methods have several defects:
1) the code writing mode comprises the following steps: the code mock interface is directly written, parameters are returned, and the writing is relatively fast through nodejs, java, python and the like. The method is not suitable for wide use, the code writing takes long time, a certain threshold is needed, and front-end personnel are required to have programming capability.
2) The fixed configuration mode: the return value is configured directly as long as a certain interface is requested, and is fixed. The method is simple, but the return value is fixed, and different values are required to be returned by the same interface at many times.
3) Configuration with programming: that is, the js script or python script can be written to the configuration interface to dynamically return the parameters. The configuration can also be made, which is similar to the mode of 2), and the problem of returning different values according to different requests can also be solved through scripts, and the fixed configuration is solved in this way, but although the script language is simpler, the front-end personnel is still required to have programming capability and certain threshold.
4) Js syntax approach: js grammar needs to be mastered, and then mock configuration is carried out according to rules. The method is a popular mode, can be directly and fixedly configured, and has no high threshold of script writing, but has complex grammar, and if the method is really used, the method is similar to the script writing, and front-end personnel are required to have programming capability.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for an interface mock.
In a first aspect, an embodiment of the present disclosure provides a method for interfacing a mock, including: receiving a mock interface request sent by a terminal, wherein the mock interface request comprises a reference and a route break; checking whether a mock interface corresponding to the route failure exists or not; if a mock interface corresponding to route dropping exists, inquiring whether a return value matched with the entering parameter exists from preset configuration information; and if the return value matched with the access parameter exists, sending the matched return value to the terminal.
In some embodiments, the method further comprises: and if the return value matched with the access parameter does not exist, sending a default return value to the terminal.
In some embodiments, the method further comprises: and if the mock interface corresponding to route failure does not exist, sending a request error message to the terminal.
In some embodiments, after receiving the mock interface request sent by the terminal, the method further includes: if the configuration information comprises an encryption mode, decrypting the received mock interface request according to the encryption mode; and encrypting the return value according to the encryption mode and then sending the encrypted return value to the terminal.
In some embodiments, the step of decrypting the received mock interface request according to the encryption mode includes: inquiring a key for decryption according to the user ID; decrypting the received mock interface request using the key.
In some embodiments, the method further comprises: and if the decryption fails, sending a request error message to the terminal.
In some embodiments, participating includes a request mode.
In a second aspect, an embodiment of the present disclosure provides an apparatus for interfacing a mock, including: the receiving unit is configured to receive a mock interface request sent by a terminal, wherein the mock interface request comprises a reference and a route postfault; a checking unit configured to check whether a mock interface corresponding to a route failure exists; the matching unit is configured to inquire whether a return value matched with the entry parameter exists from preset configuration information if a mock interface corresponding to route failure exists; and the sending unit is configured to send the matched return value to the terminal if the return value matched with the access parameter exists.
In some embodiments, the sending unit is further configured to: and if the return value matched with the access parameter does not exist, sending a default return value to the terminal.
In some embodiments, the sending unit is further configured to: and if the mock interface corresponding to route failure does not exist, sending a request error message to the terminal.
In some embodiments, the apparatus further comprises an encryption unit configured to: if the configuration information comprises an encryption mode, after receiving the mock interface request sent by the terminal, decrypting the received mock interface request according to the encryption mode; and encrypting the return value according to the encryption mode and then sending the encrypted return value to the terminal.
In some embodiments, the mock interface request includes a user ID, the encryption unit further configured to: inquiring a key for decryption according to the user ID; decrypting the received mock interface request using the key.
In some embodiments, the sending unit is further configured to: and if the decryption fails, sending a request error message to the terminal. In some embodiments, participating includes a request mode.
In a third aspect, an embodiment of the present disclosure provides an electronic device for an interface mock, including: one or more processors; a storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement a method as in any one of the first aspects.
In a fourth aspect, embodiments of the disclosure provide a computer readable medium having a computer program stored thereon, wherein the program when executed by a processor implements a method as in any one of the first aspect.
According to the method and the device for the interface mock, return values returned by the mock interface request under different scenes are set through preset configuration information. The dynamic return value is realized, the technical threshold is reduced, the capability of the interface mock is improved, and the method is simple and strong, can be used more conveniently and is suitable for more scenes.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for interfacing mock according to the present disclosure;
3a-3c are schematic diagrams of an application scenario of the method for interfacing mock according to the present disclosure;
FIG. 4 is a flow diagram of yet another embodiment of a method for interfacing mock according to the present disclosure;
FIG. 5 is a schematic block diagram of one embodiment of an apparatus for interfacing mock according to the present disclosure;
FIG. 6 is a schematic block diagram of a computer system suitable for use with an electronic device implementing embodiments of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 shows an exemplary system architecture 100 to which embodiments of the method for an interface mock or the apparatus for an interface mock of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a software testing application, a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, and 103 are hardware, they may be various electronic devices supporting the interface mock, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, motion Picture Experts compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, motion Picture Experts compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server providing various services, such as a background mock server providing a fake function for backend data missing from the terminal devices 101, 102, 103. The background mock server can analyze and process the received mock interface request and other data, and feed back the processing result (such as a preset return value) to the terminal device.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple pieces of software or software modules (e.g., multiple pieces of software or software modules used to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be noted that the method for the interface mock provided by the embodiment of the present disclosure is generally performed by the server 105, and accordingly, the apparatus for the interface mock is generally disposed in the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of one embodiment of a method for interfacing a mock according to the present disclosure is shown. The method for the interface mock comprises the following steps:
step 201, receiving a mock interface request sent by a terminal.
In this embodiment, an execution subject (for example, a server shown in fig. 1) of the method for interfacing a mock may receive a mock interface request sent by a terminal through a wired connection manner or a wireless connection manner. Wherein, the mock interface request comprises a reference and a route post-failure. Route postdetection may be understood as a portion of a url, e.g., url/getuiser url/login, etc. The entries may include information such as name, ID, etc., and may also include request methods such as POST, PUT, etc.
In step 202, whether a mock interface corresponding to the route failure exists is checked.
In this embodiment, route backoffs correspond to the types of interfaces, one type for each mock interface. The server only provides a mock interface of a limited type, so that whether route postleakage transmitted by the terminal is a supportable type needs to be judged.
In step 203, if there is a mock interface corresponding to route failure, it is queried from the preset configuration information whether there is a return value matching with the entry parameter.
In this embodiment, if the server provides a mock interface corresponding to a route failure, an interface call may be made. And matching the configuration information participating in the presetting. The configuration information is configured in different scenes, and polling can be carried out on different scenes until a scene participating in judgment condition matching is found.
Illustratively, the entry parameter is set to-
“userName”:”jwg”,
“money”:100
}
And when money is less than 100, the following message is fed back:
{
“code”:200,
message that the person is at risk and cannot lend money to him "
}
That is, as long as the interface is requested, all of money smaller than 1000 will return risky results, and all of money larger than 1000 will return no risk, which is a simple use case, that is, different results can be returned according to different requests, and no code or script can be written.
Optionally, the entry also includes a request mode, and the request mode also needs to be configured, for example, a POST mode is configured in the configuration information, and if the received interface request is a PUT mode, the matching is considered to be failed.
And step 204, if the return value matched with the access parameter exists, sending the matched return value to the terminal.
In this embodiment, as shown in fig. 3a-3c, when there is an http request to the server, it is determined which interface is according to the type (which may be understood as a part of url, e.g. url/getuiser url/logic, etc.), where the type is similar to fields of getuiser and logic, which interface is determined according to these fields, and its return value is queried according to the name of this interface, and the return value is stored in the database. Each interface corresponds to a plurality of return values, all scenes need to be inquired, screening is carried out according to parameters in the scenes, the situation that the parameters in the input parameters can be matched with one of the scenes is judged, and if the parameters are matched with one of the scenes, return data corresponding to the scene is returned. The corresponding return data in the scenario shown in fig. 3a-3c is the value in the right input box.
In step 205, if there is no mock interface corresponding to route dropped, a request error message is sent to the terminal.
In this embodiment, when the interface request comes, it is determined whether the interface exists, and if not, the request error message is directly returned.
And step 206, if no return value matched with the access parameter exists, sending a default return value to the terminal.
In this embodiment, if all the scenes are polled, and no return value matching the input parameter is found, the default return value is used for returning.
With further reference to fig. 4, a flow 400 of yet another embodiment of a method for interfacing mock is shown. The process 400 of the method for interface mock includes the following steps:
step 401, receiving a mock interface request sent by a terminal.
Step 401 is substantially the same as step 201, and therefore is not described again.
And step 402, if the configuration information includes an encryption mode, decrypting the received mock interface request according to the encryption mode.
In this embodiment, the configuration information may configure an encryption manner, such as gateway encryption. Encryption algorithms may also be configured, for example, symmetric encryption, asymmetric encryption. The key may be pre-defined.
Optionally, the mock interface request includes a user ID. Each user ID may be assigned a key in advance, each terminal may be encrypted using its own key, and the server may determine which key to decrypt based on the user ID.
Optionally, if the decryption fails, a request error message is sent to the terminal. No further steps are performed.
In step 403, checking whether a mock interface corresponding to the route successor exists.
In step 404, if there is a mock interface corresponding to route failure, it is queried from the preset configuration information whether there is a return value matching with the entry parameter.
The steps 403-404 are substantially the same as the steps 202-203, and therefore will not be described in detail.
And step 405, if the return value matched with the access parameter exists, encrypting the return value according to an encryption mode and then sending the encrypted return value to the terminal.
Step 405 is to encrypt the result of step 204 and send it to the terminal. The encryption mode is agreed in advance according to the configuration information.
And step 406, if the mock interface corresponding to the route dropped does not exist, encrypting the request error message and sending the encrypted request error message to the terminal.
Step 406 is simply to encrypt the result of step 205 and send it to the terminal. The encryption mode is agreed in advance according to the configuration information.
And step 407, if no return value matched with the access parameter exists, encrypting the default return value according to the encryption mode and then sending the encrypted return value to the terminal.
Step 407 is simply to encrypt the result of step 206 and transmit it to the terminal. The encryption mode is agreed in advance according to the configuration information.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, the flow 400 of the method for the interface mock in the present embodiment represents a step of encrypting the return value. Therefore, the scheme described in the embodiment can improve the security of data transmission.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present disclosure provides an embodiment of an apparatus for interfacing mock, where the embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 2, and the apparatus may be applied to various electronic devices.
As shown in fig. 5, the apparatus 500 for an interface mock of the present embodiment includes: receiving section 501, checking section 502, matching section 503, and transmitting section 504. The receiving unit 501 is configured to receive a mock interface request sent by a terminal, where the mock interface request includes a dropped route after participation; a checking unit 502 configured to check whether a mock interface corresponding to a route successor exists; a matching unit 503 configured to query whether a return value matching the entry parameter exists from preset configuration information if there is a mock interface corresponding to the route failure; a sending unit 504 configured to send the matched return value to the terminal if the return value matched with the entry parameter exists.
In this embodiment, the specific processing of the receiving unit 501, the checking unit 502, the matching unit 503 and the sending unit 504 of the apparatus 500 for interface mock may refer to step 201, step 202, step 203 and step 204 in the corresponding embodiment of fig. 2.
In some optional implementations of this embodiment, the sending unit 504 is further configured to: and if the return value matched with the access parameter does not exist, sending a default return value to the terminal.
In some optional implementations of this embodiment, the sending unit 504 is further configured to: and if the mock interface corresponding to route failure does not exist, sending a request error message to the terminal.
In some optional implementations of this embodiment, the apparatus further comprises an encryption unit (not shown in the drawings) configured to: if the configuration information comprises an encryption mode, after receiving the mock interface request sent by the terminal, decrypting the received mock interface request according to the encryption mode; and encrypting the return value according to the encryption mode and then sending the encrypted return value to the terminal.
In some optional implementations of this embodiment, the mock interface request includes a user ID, and the encryption unit is further configured to: inquiring a key for decryption according to the user ID; decrypting the received mock interface request using the key.
In some optional implementations of this embodiment, the sending unit 504 is further configured to: and if the decryption fails, sending a request error message to the terminal.
In some optional implementations of this embodiment, the participating includes a requesting mode.
Referring now to fig. 6, a schematic diagram of an electronic device (e.g., the server or terminal device of fig. 1) 600 suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The terminal device/server shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 6, electronic device 600 may include a processing means (e.g., central processing unit, graphics processor, etc.) 601 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Generally, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 illustrates an electronic device 600 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 6 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 609, or may be installed from the storage means 608, or may be installed from the ROM 602. The computer program, when executed by the processing device 601, performs the above-described functions defined in the methods of embodiments of the present disclosure. It should be noted that the computer readable medium described in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving a mock interface request sent by a terminal, wherein the mock interface request comprises a reference and a route break; checking whether a mock interface corresponding to the route failure exists or not; if a mock interface corresponding to route dropping exists, inquiring whether a return value matched with the entering parameter exists from preset configuration information; and if the return value matched with the access parameter exists, sending the matched return value to the terminal.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit, a checking unit, a matching unit, and a transmitting unit. Where the names of the units do not constitute a limitation on the units themselves in some cases, for example, a receiving unit may also be described as "a mock interface request sent by a receiving terminal, where the mock interface request includes a unit that is participating and dropped after a route".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the inventive concept. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (10)

1. A method for interfacing mock, comprising:
receiving a mock interface request sent by a terminal, wherein the mock interface request comprises a reference and a route post-dropping;
checking whether a mock interface corresponding to the route post-failure exists;
if a mock interface corresponding to the route after failure exists, inquiring whether a return value matched with the entry parameter exists from preset configuration information;
and if the return value matched with the access parameter exists, sending the matched return value to the terminal.
2. The method of claim 1, wherein the method further comprises:
and if the return value matched with the access parameter does not exist, sending a default return value to the terminal.
3. The method of claim 1, wherein the method further comprises:
and if the mock interface corresponding to the route failure does not exist, sending a request error message to the terminal.
4. The method of claim 1, wherein after receiving the mock interface request sent by the terminal, the method further comprises:
if the configuration information comprises an encryption mode, decrypting the received mock interface request according to the encryption mode;
and encrypting the return value according to the encryption mode and then sending the encrypted return value to the terminal.
5. The method of claim 4, wherein the mock interface request includes a user ID, and the decrypting the received mock interface request according to the encryption manner comprises:
inquiring a key for decryption according to the user ID;
decrypting the received mock interface request using the key.
6. The method of claim 4, wherein the method further comprises:
and if the decryption fails, sending a request error message to the terminal.
7. The method of any of claims 1-6, wherein the joining comprises a request mode.
8. An apparatus for an interface mock, comprising:
a receiving unit configured to receive a mock interface request sent by a terminal, wherein the mock interface request comprises a parameter and a route postreduction;
a checking unit configured to check whether a mock interface corresponding to the route successor exists;
a matching unit configured to query whether a return value matching the entry parameter exists from preset configuration information if a mock interface corresponding to the route successor failure exists;
and the sending unit is configured to send the matched return value to the terminal if the return value matched with the access parameter exists.
9. An electronic device for interfacing mock, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-7.
10. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-7.
CN202010578743.2A 2020-06-23 2020-06-23 Method and device for interface mock Pending CN111752625A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010578743.2A CN111752625A (en) 2020-06-23 2020-06-23 Method and device for interface mock

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010578743.2A CN111752625A (en) 2020-06-23 2020-06-23 Method and device for interface mock

Publications (1)

Publication Number Publication Date
CN111752625A true CN111752625A (en) 2020-10-09

Family

ID=72676568

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010578743.2A Pending CN111752625A (en) 2020-06-23 2020-06-23 Method and device for interface mock

Country Status (1)

Country Link
CN (1) CN111752625A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996181A (en) * 2021-03-02 2022-09-02 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297475A (en) * 2012-03-01 2013-09-11 阿里巴巴集团控股有限公司 Mock service system and processing method of Mock service
CN106528393A (en) * 2015-09-09 2017-03-22 北京京东尚科信息技术有限公司 Method and device for Mock testing of WebService
CN107577590A (en) * 2016-07-04 2018-01-12 北京奇虎科技有限公司 Method and device based on database service real-time calling virtual interface
CN108347356A (en) * 2017-01-24 2018-07-31 北京京东尚科信息技术有限公司 A kind of multi-protocols unit test method, device, electronic equipment and storage medium
CN108733554A (en) * 2017-04-21 2018-11-02 北京京东尚科信息技术有限公司 Mock method and apparatus
CN109656807A (en) * 2018-11-01 2019-04-19 平安科技(深圳)有限公司 Interface mock test method, device, equipment and storage medium based on information security
CN110489322A (en) * 2019-07-08 2019-11-22 中国平安财产保险股份有限公司 MOCK test method, device, computer equipment and storage medium
CN111124873A (en) * 2018-10-31 2020-05-08 北京国双科技有限公司 Method and device for returning Mock data

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297475A (en) * 2012-03-01 2013-09-11 阿里巴巴集团控股有限公司 Mock service system and processing method of Mock service
CN106528393A (en) * 2015-09-09 2017-03-22 北京京东尚科信息技术有限公司 Method and device for Mock testing of WebService
CN107577590A (en) * 2016-07-04 2018-01-12 北京奇虎科技有限公司 Method and device based on database service real-time calling virtual interface
CN108347356A (en) * 2017-01-24 2018-07-31 北京京东尚科信息技术有限公司 A kind of multi-protocols unit test method, device, electronic equipment and storage medium
CN108733554A (en) * 2017-04-21 2018-11-02 北京京东尚科信息技术有限公司 Mock method and apparatus
CN111124873A (en) * 2018-10-31 2020-05-08 北京国双科技有限公司 Method and device for returning Mock data
CN109656807A (en) * 2018-11-01 2019-04-19 平安科技(深圳)有限公司 Interface mock test method, device, equipment and storage medium based on information security
CN110489322A (en) * 2019-07-08 2019-11-22 中国平安财产保险股份有限公司 MOCK test method, device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114996181A (en) * 2021-03-02 2022-09-02 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium
CN114996181B (en) * 2021-03-02 2023-09-26 北京同邦卓益科技有限公司 Interface routing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111931962B (en) Information display method and device and electronic equipment
CN111199037B (en) Login method, system and device
CN110781373B (en) List updating method and device, readable medium and electronic equipment
US20220374538A1 (en) Permission control method and device and electronic equipment
US11758087B2 (en) Multimedia conference data processing method and apparatus, and electronic device
CN111163324B (en) Information processing method and device and electronic equipment
CN112866385B (en) Interface calling method and device, electronic equipment and storage medium
CN112702336A (en) Security control method and device for government affair service, security gateway and storage medium
CN112329044A (en) Information acquisition method and device, electronic equipment and computer readable medium
CN111752625A (en) Method and device for interface mock
CN111798251A (en) Verification method and device of house source data and electronic equipment
CN113079085B (en) Business service interaction method, business service interaction device, business service interaction equipment and storage medium
CN114048498A (en) Data sharing method, device, equipment and medium
CN110855655B (en) Information verification method, device, equipment and storage medium
CN111460020B (en) Method, device, electronic equipment and medium for resolving message
CN111897620A (en) Interaction method and device and electronic equipment
CN113890772A (en) Information processing method and device and electronic equipment
CN113472785B (en) Data processing method and device, electronic equipment and readable storage medium
CN110781523B (en) Method and apparatus for processing information
CN111835846B (en) Information updating method and device and electronic equipment
CN113076195B (en) Object shunting method and device, readable medium and electronic equipment
CN110909382B (en) Data security control method and device, electronic equipment and computer readable medium
CN111694679B (en) Message processing method and device and electronic equipment
CN112468470B (en) Data transmission method and device and electronic equipment
CN116596092A (en) Model training method, instant pushing method, device, medium and electronic equipment

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
CB02 Change of applicant information

Address after: Room 221, 2nd floor, Block C, 18 Kechuang 11th Street, Daxing Economic and Technological Development Zone, Beijing, 100176

Applicant after: Jingdong Technology Holding Co.,Ltd.

Address before: Room 221, 2nd floor, Block C, 18 Kechuang 11th Street, Daxing Economic and Technological Development Zone, Beijing, 100176

Applicant before: Jingdong Digital Technology Holding Co.,Ltd.

Address after: Room 221, 2nd floor, Block C, 18 Kechuang 11th Street, Daxing Economic and Technological Development Zone, Beijing, 100176

Applicant after: Jingdong Digital Technology Holding Co.,Ltd.

Address before: Room 221, 2nd floor, Block C, 18 Kechuang 11th Street, Daxing Economic and Technological Development Zone, Beijing, 100176

Applicant before: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.

CB02 Change of applicant information