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
Lazarus Lazaridis edited this page Nov 17, 2017
·
3 revisions
Here we will see how we can create the simplest kind of mock, the static one.
Click the Create new mock button in the home page and fill in the fields of the General tab as shown in the picture:
Mind the path /my-static-mock and the request method get. Once done, the mock will be being served with get requests on the https://localhost:8080/my-static-mock (here I assume you have DuckRails started on port 8080)
Navigate to the Response body tab and set the Body type field to Static.
Fill in the following html code as Body content:
<!DOCTYPE html><html><head><title>Static mock title</title></head><body><h1>This is a static mock</h1><table><thead><tr><th>First column header</th><th>Second column header</th></tr></thead><thead><tr><td>First column</td><td>Second column</td></tr></thead></table></body></html>
and set Content type to text/html.
Finally, change to the Headers tab and add a header:
As you can see in the picture below, the mock's body content is being displayed as html and the response contains the DuckRails-Static header that we defined.
Now let's change the Content type to text/plain and check what happens. Alter the mock Content type as shown here:
Save and request the mock again. You should be seeing the Body content being rendered as plain text!