You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using WIreMock 3.0 the FileSource implementation provided to ResponseDefinitionTransformer is BlobStoreFileSource which returns an empty string for getPath.
Use case in WireMock 2
We manually proxy unmatched SOAP requests. When proxying a request we need to update the WSA:To value in the request body. We do this in a ResponseDefinitionTransformer which:
Is triggered by a catch-all stub mapping
Creates a modified request with an updated body
Makes a request
Stores a new stub mapping for the response
To do (4), we use the path from the FileSource to find the root directory containing __files and mappings, in order to save our new stub mapping JSON file to mappings
Issue in WireMock 3
In WireMock 3.0, we can access the root directory by constructing our extension through ExtensionFactory. However, wiremock-standalone doesn't load ExtensionFactory implementations. (It loads the --extensions parameter into ExtensionDeclarationsas Extension class names)
We can load an ExtensionFactory via a service provider, but this means that the extension is always enabled.
Possible resolutions
To resolve this issue we need any of:
The WireMock 2 behaviour to be restored to getPath in ResponseDefinitionTransformer
ExtensionFactory support in wiremock-standalone
A mechanism for disabling SPI ExtensionFacctory loading in wiremock-standalone
A transformer interface which would allow us to transform a request body before proxying (using the built in proxy mechanism)
Reproduction steps
ExtendResponseDefinitionTransformer and register it
Access FileSource#getPath in ResponseDefinitionTransformer#transform
References
No response
The text was updated successfully, but these errors were encountered:
@tomakehurst Thanks, I've built #2396 locally and confirmed that it's returning the path as expected.
Following up on the use within wiremock-standalone - I presume that ResponseDefinitionTransformer will be removed in WireMock 4.0, is there a feature planned for loading extensions in wiremock-standalone via ExtensionFactory?
I think ResponseDefinitionTransformer will most likely be removed in 4.0, but it depends how quickly we get to it. The v2 version is quite similar so porting your extension shouldn't take more than an hour.
If you include a service definition file in your extension JAR for the factory class it'll be scanned and loaded automatically by standalone. That's the recommended way to do it.
Proposal
Using WIreMock 3.0 the
FileSource
implementation provided toResponseDefinitionTransformer
isBlobStoreFileSource
which returns an empty string forgetPath
.Use case in WireMock 2
We manually proxy unmatched SOAP requests. When proxying a request we need to update the
WSA:To
value in the request body. We do this in aResponseDefinitionTransformer
which:To do (4), we use the path from the
FileSource
to find the root directory containing__files
andmappings
, in order to save our new stub mapping JSON file tomappings
Issue in WireMock 3
In WireMock 3.0, we can access the root directory by constructing our extension through
ExtensionFactory
. However,wiremock-standalone
doesn't loadExtensionFactory
implementations. (It loads the--extensions
parameter intoExtensionDeclarations
asExtension
class names)We can load an
ExtensionFactory
via a service provider, but this means that the extension is always enabled.Possible resolutions
To resolve this issue we need any of:
getPath
inResponseDefinitionTransformer
ExtensionFactory
support inwiremock-standalone
ExtensionFacctory
loading inwiremock-standalone
Reproduction steps
ResponseDefinitionTransformer
and register itFileSource#getPath
inResponseDefinitionTransformer#transform
References
No response
The text was updated successfully, but these errors were encountered: