Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 764 Bytes

README.md

File metadata and controls

31 lines (27 loc) · 764 Bytes

wiremock client

This library can be used if a Wiremock instance is running, to interact like the actions given in the api http://wiremock.org/docs/api/

Usage

import { WiremockHelper, stubForOkResponseWithBody, forGetRequestMatchingUrl} from 'wiremock-client';

const wiremockClient = new WiremockHelper();
/*
Sample mapping to be configured in wiremock server
{
    request: {
        url: '/sample/path',
        method: 'GET'
    },
    response: {
        status: 200,
        jsonBody: {
            "greeting": "Hello world."
        }
    }
}
 */
const sampleMapping = stubForOkResponseWithBody(
    forGetRequestMatchingUrl("/sample/path"), 
    '{"greeting": "Hello world."}'
    )       

wiremockClient.addMapping(sampleMapping);