Forum Discussion
SmartBear_Suppo
Alumni
14 years agoHi,
You probably need to make sure that the contentType is set before you open for writing.
I.e. move httpResponse.setContentType( 'application/json' ) up higher:
Does this work for you?
/ Henrik
You probably need to make sure that the contentType is set before you open for writing.
I.e. move httpResponse.setContentType( 'application/json' ) up higher:
def httpResponse = mockRequest.httpResponse
httpResponse.setContentType( 'application/json' )
def fileInputStream= this.getClass().getClassLoader().getParent().getResourceAsStream(mockServerResponseDir + responseFileName)
httpResponse.setStatus(httpStatusCode)
// contentType needs to be set before this line
def length = IOUtils.copy(fileInputStream, httpResponse.getOutputStream())
Does this work for you?
/ Henrik