I have a service that I don't own and have no control over that uses the statusMessage (also called reason phrases) to communicate information that is critical to take action on.
An example is wget https://example.com in my scenario would return:
HTTP request sent, awaiting response... 503 up
503 is the statusCode
up is the statusMessage
I need to be able to mock this statusMessage with mountebank as the "up" message is necessary to do certain actions on.
Looking into the nodejs http code we can see statusMessage is an optional argument that defaults what we normally see as the message (but it is overridable).
Steps to reproduce
There's no current way to mock the statusMessage
Software versions used
OS :
mountebank :
node.js :
(only if installed via npm)
Installation method :
(npm, zip, tar, pkg, deb, rpm)
mountebank latest
Log contents in mb.log when running mb --loglevel debug
Log contents here
No logs as its not compatible with the code if I'm groking
Expected behaviour
I was hoping I could add a statusMessage in the response body:
Which in turn in mountebank would essentially do:
Actual behaviour
I have a service that I don't own and have no control over that uses the statusMessage (also called reason phrases) to communicate information that is critical to take action on.
An example is
wget https://example.com
in my scenario would return:503
is the statusCodeup
is the statusMessageI need to be able to mock this statusMessage with mountebank as the "up" message is necessary to do certain actions on.
Mountebank uses writeHead from node https://github.com/nodejs/node/blob/99f6084ef04dd868c7b894ca0fdbb5088773ca6c/lib/_http_server.js#L341-L365
Here: https://github.com/bbyars/mountebank/blob/09e2e4a31f696b5555e7a250b5a440816cea91bc/src/models/http/baseHttpServer.js#L143
Looking into the nodejs http code we can see statusMessage is an optional argument that defaults what we normally see as the message (but it is overridable).
Steps to reproduce
There's no current way to mock the statusMessage
Software versions used
mountebank latest
Log contents in mb.log when running mb --loglevel debug
No logs as its not compatible with the code if I'm groking