You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: netmockery/documentation.md
+184-6Lines changed: 184 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,11 @@ Command line:
12
12
13
13
netmockery.exe p:\ath\to\endpoint\directory
14
14
15
-
Netmockery starts and listens on port ``5000``.
15
+
Netmockery starts and listens on ``localhost`` port ``5000``.
16
+
17
+
To bind to another address/port, use the ``--url`` command line parameter. The command below binds netmockery to all network interfaces using port 9876.
The first step in handling incoming request is to check the incoming request's request path. The request path is matched against each ``pathregex`` for all
81
85
endpoints in the endpoint collection directory.
82
86
83
-
Exactly one endpoint must match the request. If zero or more than one endpoint matches the incoming request,
84
-
netmockery writes an error message to the console output, and returns nothing to the client.
87
+
Exactly one endpoint must match the request. If zero endpoints matches the incoming request,
88
+
netmockery writes an error message to the console output, and returns nothing to the client. If more than one endpoint
89
+
matches the incoming request, netmockery writes an error message to the console output, and returns nothing to the client.
85
90
86
91
The second and final step in the request matching process is to check the incoming request against the list of rules in ``responses``. The first rule that matches
87
92
the request will be used for creating the response. If no rule matches the request, netmockery writes an error message to the console output and returns nothing to
88
93
the client.
89
94
90
-
The ``match``paramter within the ``responses`` list can match requests using one of these methods:
95
+
The ``match``parameter within the ``responses`` list can match requests using one of these methods:
91
96
92
97
### Match any request
93
98
@@ -140,12 +145,184 @@ Inside a script, the following global variables and functions are available:
140
145
141
146
TODO: More scripting documentation.
142
147
148
+
### Forwarding requests
149
+
150
+
You can configure a rule to forward the request to an external service:
151
+
152
+
*``"strippath": "^/myservice"``: A reqular expression that is removed from the request path when calling the external url.
153
+
*``"forward": "https://example.com/the/real/service"``: Forwards the request to the specified url
154
+
*``"proxy": "http://proxy:port"``: (optional) Uses the specified proxy when doing the request
0 commit comments