- Service available?
- callback:
service_available?
- false:
503 Service Unavailable
- callback:
- Known method?
- callback:
known_methods
- callback:
- absent:
501 Not Implemented
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
# Notes: | |
# Headers and status would still be value based matching | |
# Default to type based matching??? | |
# like(xxx) means xxx and all children would be matched using type based matching | |
# literal(xxx) means xxx and all children would be matched using exact value matching | |
# eg(generate, matcher) would be a regular expression match | |
# each_like([]) would indicate the each element in the array should be like the example given | |
# A like() could be nested inside a literal() which could be nested inside a like() - at each stage, | |
# it changes the matching type for all children until it gets switched back. |
Assumptions based on experience with pacts so for:
- The most common type of matching that is useful is asserting that:
- The expected keys are present
- The values at the actual keys are of the same class (string/number/nil) as the expected values
- Occasionally we'll want a literal match
- Occasionally we'll want a regular expresssion
- Extra keys in a hash are OK for responses but not for requests (following the "be strict with what you send out, be lax with what you accept" principle)
- Extra items in an array are debatable (extra keys in a hash are generally ignored, however, all items in an array are generally processed, so allowing "unverified" extras to sneak in could be a bad thing. Working out what to do with "extras" is not immediately obvious to me however.)
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
You will need ruby or the standalone mock service to run these examples. | |
$ gem install pact-mock_service |
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
// attribution: http://stackoverflow.com/a/15281070/32453 | |
// you can compile this with gcc [mingw or mingw-w64] and probably other compilers as well | |
#include <stdlib.h> // NULL | |
#include <stdbool.h> // false | |
#include <windows.h> // AttachConsole, CTRL_C_EVENT, etc. | |
#include <stdio.h> // printf | |
#include <strsafe.h> | |
void logLastError() |