5

I am want to know whether WireMock supports keep-alive by default or I need to set it explicitly somewhere.

I have setup a basic WireMock standalone which accepts request and generates a json payload. However when I curl -v the service I do not see the Connection: keep-alive header generated.

Also when I make a call to the mock service using the apache benchmark tool with -k option I do see lot of connections getting created and destroyed which means wiremock by default is not supporting the keep-alive.

I assume there must be something on the WireMock server to tell it to support persistent connections by default?

Regards, Adi

user1619355
  • 429
  • 1
  • 4
  • 17

1 Answers1

0

You could have that header returned by updating your mapping as such:

"response": { "headers": { "Content-Type": "application/json" }

This however doesn't mean that it's a persistent connection and persistent connections are supported on WireMock. There is a "persistent" option for mappings, but per the WireMock docs, it's:

Indicates that the stub mapping should be persisted immediately on create/update/delete and survive resets to default.

https://wiremock.org/docs/api/#tag/Stub-Mappings/paths/~1__admin~1mappings/get

Scott Merritt
  • 1,284
  • 2
  • 13
  • 24