Is there a way to store a HTTP Request Body as a file? #403

Closed
opened 2025-12-29 15:22:53 +01:00 by adam · 2 comments
Owner

Originally created by @Loydik on GitHub (Feb 10, 2022).

Hi,

I am wondering how to store HTTP request body as a file using wiremock.net, and cannot figure it out. I have a service which uses another service to upload a file to Azure Datalake, lets call it FileUploader. It receives file contents in HTTP request body, and then it uploads it to Datalake. I would like to mock FileUploader, and instead of sending stuff to Datalake, the mock should take http request body and store it, so I can access it later (store it as a file, or any other solution really).
There is a good article on how to achieve this in java Wiremock using Extensions, but it seems not to be possible in Wiremock.Net for some reason. Was extending Wiremock not implemented in .Net version? Or am I missing something? Here is an article:

https://medium.com/edc-dev-chapter/storing-a-http-request-body-using-a-wiremock-extension-ef3f2a60abcb

Thank you very much!

Originally created by @Loydik on GitHub (Feb 10, 2022). Hi, I am wondering how to store HTTP request body as a file using wiremock.net, and cannot figure it out. I have a service which uses another service to upload a file to Azure Datalake, lets call it FileUploader. It receives file contents in HTTP request body, and then it uploads it to Datalake. I would like to mock FileUploader, and instead of sending stuff to Datalake, the mock should take http request body and store it, so I can access it later (store it as a file, or any other solution really). There is a good article on how to achieve this in java Wiremock using Extensions, but it seems not to be possible in Wiremock.Net for some reason. Was extending Wiremock not implemented in .Net version? Or am I missing something? Here is an article: https://medium.com/edc-dev-chapter/storing-a-http-request-body-using-a-wiremock-extension-ef3f2a60abcb Thank you very much!
adam added the question label 2025-12-29 15:22:53 +01:00
adam closed this issue 2025-12-29 15:22:53 +01:00
Author
Owner

@StefH commented on GitHub (Feb 11, 2022):

@Loydik

A possible solution would be to run WireMock.Net in proxy mode https://github.com/WireMock-Net/WireMock.Net/wiki/Proxying

Another option would be to view the requests which are made to WireMock:
https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Server/WireMockServer.LogEntries.cs#L40

Notice that WireMock.Net is internally not the same as WireMock

@StefH commented on GitHub (Feb 11, 2022): @Loydik A possible solution would be to run WireMock.Net in proxy mode https://github.com/WireMock-Net/WireMock.Net/wiki/Proxying Another option would be to view the requests which are made to WireMock: https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Server/WireMockServer.LogEntries.cs#L40 Notice that WireMock.Net is internally not the same as WireMock
Author
Owner

@Loydik commented on GitHub (Feb 14, 2022):

@StefH thank you, that was helpful :)

@Loydik commented on GitHub (Feb 14, 2022): @StefH thank you, that was helpful :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#403