Forum Discussion

vikititor's avatar
vikititor
Contributor
6 years ago

serviceV how to get resource path parameter in script

How I am able to use resource parameter in dispach script? For example I have mock REST service "context/{resourceID}/otherPath" What I want to use is the "resourceID" in my response. So I need rea...
  • vikititor's avatar
    6 years ago

    I am parsing request resource path in my response in script like this:

    my MOCK operation is: POST submit/{ORI}/method

    and how I am getting ORI value in my response is done by this script. Then value is used in future in response..

    But I hope there must be more comfortable way, how to get this..

    def requestPath = mockRequest.getPath()
    log.info "Path: "+ requestPath
    
    requestPath = requestPath.replace("/submit/", "")
    def ORI = requestPath.substring(0, requestPath.indexOf("/"))
    log.info "ORI: " + ORI
    
    return