This repository has been archived by the owner on Dec 12, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Update README with response file format examples #6
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,49 @@ A url protocol that parses and returns fake responses with mock data. | |
Create a folder reference called `VOKMockData`, so that the entire `VOKMockData` directory is copied into your test app bundle and place mock data files in there. The easiest way to determine the proper file name for a mock data item is to make the mock API call and note the missing mock data file reported in the logs. Mock data files may: | ||
|
||
- have the `.json` extension to always return an `HTTP/1.1 200 Success` with `Content-type: text/json` and the content of the `.json` file; or | ||
- have the `.http` extension to parse a full HTTP response including status, headers, and body from the file. | ||
- have the `.http` extension to parse an HTTP response with the following format: | ||
- status on the first line | ||
- headers on the following lines | ||
- blank line | ||
- body on the following lines | ||
|
||
Example HTTP responses: | ||
|
||
HTTP response with headers and response body. | ||
``` | ||
HTTP/1.1 201 CREATED | ||
Server: nginx/1.4.6 (Ubuntu) | ||
Date: Thu, 02 Oct 2014 20:50:29 GMT | ||
Content-Type: application/json | ||
Transfer-Encoding: chunked | ||
Connection: keep-alive | ||
Vary: Accept, Cookie | ||
X-Frame-Options: SAMEORIGIN | ||
Allow: POST, OPTIONS | ||
|
||
{"id": 63, "auth_token": "50db3356e743fa3f1b790a8648fc15cc4bbf04a2", "phone_number": "+13125551214", "email": "test33@test.com", "name": "Testy McTesterson", "role": "Customer"} | ||
``` | ||
|
||
HTTP response with headers and no body. Note the blank line at the end! | ||
``` | ||
HTTP/1.1 202 Accepted | ||
Content-Type: text/plain; charset=UTF-8 | ||
Date: Fri, 17 Oct 2014 14:12:46 GMT | ||
Server: Apache-Coyote/1.1 | ||
Content-Length: 0 | ||
Connection: keep-alive | ||
|
||
``` | ||
|
||
HTTP response with no headers and no body. Note the blank line at the end! | ||
``` | ||
HTTP/1.1 202 Accepted | ||
|
||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto here about one blank line:
|
||
|
||
HTTP response with no headers and a body. | ||
``` | ||
HTTP/1.1 202 Accepted | ||
|
||
{"favorite_dog_breed": "dogfish"} | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And ditto here about one blank line:
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In vokal-isaac/VOKMockUrlProtocol@924cd90, I've adjusted the regex so that it fits with our current understanding of what's standard, which means that this should be one blank line: