https://www.wiremock.io logo
Join SlackCommunities
Powered by
# help
  • j

    Josep

    04/02/2025, 3:03 PM
    Hi! I am trying to use environment variables with the templating engine, so that I can modify an output xml based on an environment variable. This is working for me: in stubs.json "transformers": ["response-template"], "bodyFileName": "my.xml", "transformerParameters": { "newIp": "192.168.1.1" } and in xml file: uri="https://{{parameters.newIp}} Now, I would like to use the value of an environment variable instead of hardcoding the IP in the newIp parameter. I have tried setting the variable in docker compose, but then I get java.util.MissingResourceException error. I have been playing with several combinations of {{systemValue type='ENVIRONMENT' key='SERVER_IP' default='127.0.0.1'}} in payload or stub file, but I get the java error or no substitution is performed. In one case, I got this trace in the output payload: uri="https//[ERROR Access to SERVER_IP is denied] How could I do this? Thanks in advance for your help!
    l
    • 2
    • 4
  • a

    Andrew Smith

    04/03/2025, 2:34 PM
    Is there an option to disable the admin endpoints?
    l
    • 2
    • 1
  • j

    Jakub Vana

    04/04/2025, 1:05 PM
    Hello, can someone help me with starting WireMock in docker with configured HTTPS? I am trying to use this command on my Windows machine, but I am getting still the
    MissingResourceException
    . It is interesting, beacuse if I remove the keystore password from the command I getting the
    keystore password was incorrect
    message so the provided certificate should be mounted right. Thank you very much for help.
    docker run -p 8443:8443 -v C:/wiremock/ssl:/ssl wiremock/wiremock --https-port 8443 --https-keystore /ssl/localhost.p12 --https-keystore-password password
    r
    • 2
    • 1
  • b

    Brandon Chatham

    04/04/2025, 11:48 PM
    Hi there - does anyone know of a way to trigger mappings reset from JSON mappings as a post-response action? I found some documentation on using postServeActions. I tried:
    Copy code
    "postServeActions": {
        "reset-scenarios": {
          "parameters": {}
        }
      }
    But this didn't work. Thanks in advance for any help
    l
    • 2
    • 10
  • r

    Richa Tekriwal

    04/08/2025, 10:07 AM
    Hi All , I am having a docker.compose.yml which I am using to run wiremock image on my local and to copy all my stub mappings. It is working fine on http with port 8080. Now , I have created a keystore.jks and I am trying to use that cert to run wiremock using https with port 8443 , but it keeps failing with MissingResourceException . I have added entry in volumes: • ./keystore.jks:/home/wiremock/keystore.jks And my command is - ["--verbose", "--https-port", "8443", "--https-keystore", "/home/wiremock/keystore.jks", "--https-keystore-password","password" I have checked that the password of keystore is correct and also location is correct as cert is in the same directory as my docker-compose.yml. I have also checked permissions on cert. Any ideas why am I getting this error ?
    • 1
    • 1
  • n

    Nagaraj Manohar

    04/11/2025, 2:23 PM
    #C03N1E6HFPY Im using wiremock in k8 pod and my application sends the request to wiremock where I don’t have control on the request url or body I want to achive the parallel testing using wiremock how to achive this with current setup Note - application has only one field for the wiremock url config #C04HHJ7F20G #C05JPEKGYQ0
  • o

    Oliver Jankowski

    04/14/2025, 7:28 AM
    Hello, I'm trying to mock an DMS API. For this, I upload a PDF and save the data as Base64-data in memory using the wiremock-state-extension. Something like this:
    Copy code
    "serveEventListeners": [
      {
        "name": "recordState",
        "parameters": {
          "context": "{{response.headers.DocumentId}}",
          "state": {
            "blob": "{{{request.bodyAsBase64}}}"
          }
        }
      }
    ]
    Now I want to download the same data, but I can't use base64Body (see below), because base64Body doesn't support templating and I only can enter real base64 data there.
    Copy code
    "response": {
      "status": 200,
      "base64Body": "{{state context=(state context=request.path.documentId property='contentLocationUri') property='blob'}}",
      "headers": {
        "Content-Type": "application/octet-stream",
        "D3-Filename": "{{state context=request.path.documentId property='filename'}}"
      }
    }
    Neither Base64 decoding works, because it produces illegal chars.
    Copy code
    "response": {
      "status": 200,
      "body": "{{#base64 decode=true}}{{state context=(state context=request.path.documentId property='contentLocationUri') property='blob'}}{{/base64}}",
      "headers": {
        "Content-Type": "application/pdf",
        "D3-Filename": "{{state context=request.path.documentId property='filename'}}"
      }
    }
    Can someone please help me? Thanks in advance Oliver
    👀 1
    d
    l
    • 3
    • 14
  • r

    Richa Tekriwal

    04/14/2025, 2:30 PM
    Has anyone used extension - wiremock-graphql-extension-0.9.0.jar for GraphqlBodyMatcher. 1. I am able to load this extension with dockerfile but not able to load it using jav- command to run standalone jar with this extension- keep on getting exception in thread main. 2. Have you got ignoreextravariables and query pattern to ise regex working with this extension?
  • r

    Richa Tekriwal

    04/14/2025, 2:30 PM
    Has anyone used extension - wiremock-graphql-extension-0.9.0.jar for GraphqlBodyMatcher. 1. I am able to load this extension with dockerfile but not able to load it using jav- command to run standalone jar with this extension- keep on getting exception in thread main. 2. Have you got ignoreextravariables and query pattern to ise regex working with this extension?
    l
    • 2
    • 3
  • d

    Dan Baehr

    04/16/2025, 3:51 PM
    I see there is rate limiting support available for WM cloud - https://docs.wiremock.io/user-rate-limits. Any similar options for rate limiting simulation for the self-hosted WM instance?
    l
    • 2
    • 1
  • y

    Yonathan Shtekel

    04/17/2025, 2:13 PM
    Hi, I'm trying to run the wiremock-grpc extension with .proto files that include imports of other local .proto files (not Google imports). Does anyone There is a schema registry support ?
  • s

    Slackbot

    04/22/2025, 2:55 PM
    This message was deleted.
    l
    m
    • 3
    • 2
  • a

    Abhishek R Prasad

    04/22/2025, 4:38 PM
    Hello , I am trying to connect my wiremock Deployment to an Azure Files Storage so that I can persist all the mappings which I configure using "/__admin/mappings". Here's my Yaml File .
    Copy code
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: mec-cc-wiremock-cdt
      namespace: mec-carrier-connector-cdt
      labels:
        app: wiremock-custom
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: mec-cc-wiremock-cdt
      template:
        metadata:
          labels:
            app: mec-cc-wiremock-cdt
        spec:
          volumes:
            - name: mec-cc-wiremock-cdt-storage
              persistentVolumeClaim:
                claimName: mec-cc-wiremock-storage
          containers:
            - name: mec-cc-wiremock-custom-cdt
              image: wiremock/wiremock:3.12.1-1
              args:
                - "--persist-mappings"
              volumeMounts:
              - name: mec-cc-wiremock-cdt-storage
                mountPath: /mnt/azure
              ports:
                - containerPort: 8080
              securityContext:
                allowPrivilegeEscalation: false
              resources:
                limits:
                  cpu: 1500m
                  memory: 2Gi
                requests:
                  cpu: 750m
                  memory: 1Gi
              livenessProbe:
                tcpSocket:
                  port: 8080
                initialDelaySeconds: 10
                timeoutSeconds: 1
                periodSeconds: 10
                successThreshold: 1
                failureThreshold: 5
              readinessProbe:
                tcpSocket:
                  port: 8080
                initialDelaySeconds: 10
                timeoutSeconds: 1
                periodSeconds: 10
                successThreshold: 1
                failureThreshold: 5
    I am unable to persist the mappings this way. Am I doing something wrong ? I would really appreciate any help !!! 🙌
    m
    • 2
    • 6
  • b

    Bryson Edwards

    04/23/2025, 6:20 PM
    Hi team, is there a way to auto forward the request to actual API if there is no mock for that api available? A team member of mine mentioned that this was possible in an earlier version but they said when we moved to the docker deployment of wiremock the import feature stopped working
    l
    • 2
    • 1
  • a

    Alex Jircan

    04/24/2025, 9:05 AM
    Hello team, I noticed that we can retrieve requests by matching the stub ID, as mentioned here: https://wiremock.org/docs/verifying/#filtering-events. However, it seems we can't delete requests using the stub ID, according to this section: https://wiremock.org/docs/verifying/#removing-items-from-the-journal Am I missing something, or should I go ahead and open an issue on GitHub?
    t
    • 2
    • 1
  • a

    Abhishek R Prasad

    04/25/2025, 8:14 AM
    Hello Team, I am using the latest version of Wiremock which I have deployed on Kubernetes. I am using this to perform Load Tests on a particular application. I noticed that the Memory utilization does not go down once the load tests are complete. Is this an expected behaviour from Wiremock or am I missing something?
    l
    • 2
    • 9
  • e

    Ediba Zugor

    04/25/2025, 9:35 AM
    Hello Team, I am currently using Wiremock for our development process. I am getting a request token in the serveEventListeners ( code is below ) . I have my request token inside of originalRequest.query.token ( tested it and it works correctly ), then I want to extract the middle part of the jwt token with regexExtract (code below again), but the problem is that the 'parts.1' doesn't work at all. I tried multiple versions like just using 1 etc, but nothing works. Does somebody know what the problem may be?
    Copy code
    "serveEventListeners": [
        {
          "name": "webhook",
          "parameters": {
            "method": "POST",
            "url": "https://......",
            "headers": {
              "Accept": "application/json; charset=utf-8; version=1",
              "Content-Type": "application/json"
            },
            "body": "{\"test\": \"{{regexExtract originalRequest.query.token '^[^.]+\\.([^.]+)\\..*$' 'parts.1'}}\"}"
    
          }
        }
      ]
    l
    • 2
    • 12
  • m

    Mitch Smith

    04/25/2025, 6:47 PM
    does anyone have experience with using this Wiremock CSV extension? I am trying to set it up in Wiremock Open Source (in Docker). https://github.com/massamany/WireMockCsv I've got the extension
    .jar
    in the
    /var/wiremock/extensions
    folder, but it doesn't seem to load the extension (rebuilt image, recreated container, and startup log displays all my other exceptions but not this one) edit - answered my own question 🙂
    ✅ 1
    • 1
    • 4
  • e

    Ed

    04/29/2025, 7:53 AM
    Hi all,
  • e

    Ed

    04/29/2025, 7:57 AM
    I'm using wiremock in standalone mode to proxy request to another server and to remove the Authorization header before sending the request to the other server. The proxy works well but the Authorization header is not remove. I start wiremock with this command line:
    java -jar .\wiremock-standalone-3.13.0.jar --print-all-network-traffic
    I have a json file in the mappings directory that configure the proxy and should remove Authorization header:
    Copy code
    {
      "request": {
        "method": "POST",
        "url": "/notification"
      },
      "response": {
        "proxyBaseUrl": "<http://localhost:8081>",
        "removeProxyRequestHeaders": [
          "Authorization"
        ]
      }
    }
    but at the end, the Authorization header is still sent to the final server did I miss anything?
    l
    • 2
    • 8
  • a

    Abhishek R Prasad

    04/30/2025, 6:10 AM
    Hi Team , I received this error when I tried to create a stub which has dynamic response based on the value of a query parameter sent in the request. Here's the Stub creation request :
    Copy code
    curl --request POST \   --url <http://localhost:8080/__admin/mappings> \   --header 'content-type: application/json' \   --data '{   "priority": 15,   "request": {     "method": "GET",     "urlPath": "/reports/awb/tracking",     "queryParameters": {       "clientId": {         "equalTo": "323245"       },       "language": {         "equalTo": "en"       },       "awb[]": {         "matches": ".+"       }     }   },   "response": {     "status": 200,     "headers": {       "Content-Type": "application/json"     },     "jsonBody": {         "status": "success",         "data": [           {             "awbNumber": "{{request.query.awb[0]}}",             "content": "test",             "confirmation": {               "name": "test",               "date": "2023-03-06 13:58"             },             "returnAwbNumber": null,             "events": [               {                 "id": "H4",                 "name": " Shipment sorted on the belt",                 "location": "Bucharest",                 "date": "2023-03-01 04:46:46"               },               {                 "id": "H10",                 "name": " Shipment in transit towards the destination warehouse ",                 "location": "Bucharest",                 "date": "2023-03-01 05:19:10"               }             ]           }         ]       },     "transformers": [       "response-template"     ]   },   "persistent": true }'
    I have deployed Wiremock using Flux (kubernetes) and I am using the below arguments :
    Copy code
    args:
      - "--no-request-journal"
      - "--disable-request-logging"
      - "--max-template-cache-entries=50"
      - "--local-response-templating"
      - "--root-dir"
      - "/mnt/azure"
    not sure why "--local-response-templating" does not work in this case. Could you please let me know how I can fix this 🙂 .
    l
    • 2
    • 2
  • c

    Claudio Waldvogel

    04/30/2025, 9:58 PM
    Hi, I'm trying to implement a custom WebhookTransformer to sign a request body with a secretKey. The transformer is porperly invoked before dispatching the webhook. But it is always invoked as soon as the transformer is registered. Is it possible to limit invocation only to stubs where it is explicitly defined? Code of the transformer:
    Copy code
    public class WebhookSigningExtension implements WebhookTransformer {
    
    
        @Override
        public WebhookDefinition transform(ServeEvent serveEvent, WebhookDefinition webhookDefinition) {
            System.out.println("WebhookSigningExtension: transform called");
            return webhookDefinition;
        }
    
        @Override
        public String getName() {
            return "webhook-signer";
        }
    }
    Code to test the transformer:
    Copy code
    public class Main {
    
        public static void main(String[] args) {
            WireMockServer wireMockServer = new WireMockServer(
                    WireMockConfiguration.options().port(8080).extensions(new WebhookSigningExtension())
            );
    
            wireMockServer.start();
    
            wireMockServer.stubFor(<http://WireMock.post|WireMock.post>(WireMock.urlPathEqualTo("/webhook"))
                    .willReturn(WireMock.ok())
                    .withServeEventListener("webhook", Webhooks.webhook()
                            .withMethod(<http://RequestMethod.POST|RequestMethod.POST>)
                            .withUrl("<http://localhost:9898/webhook/test>")
                            .withHeader("Content-Type", "application/json")
                            .withBody("{ \"result\": \"SUCCESS\" }"))
            );
    
        }
    }
    Do I have to implement the logic to enabled/disable the transformer by passing custom parameter? Thanks in advance, Claudio
    t
    a
    • 3
    • 3
  • p

    Patrick Davy

    05/01/2025, 4:27 PM
    Hello, I've got a bit of an issue deploying wiremock as an appservice in azure... We're using wiremock to act as a stub for a training mode in our app. The plan was to build our own image with the json config baked in, that works fine locally. It also works fine when I build/push to our azure container registry from our pipelines and pull locally. Now when it comes to deploying into an azure app service, the server responds but all of our mapping config isn't in the
    home/wiremock
    directory anymore, it's exactly the same image as the one I pulled and tested locally. Any ideas what's going on here or potential avenues of investigation?
    • 1
    • 1
  • b

    Barns Anderson

    05/05/2025, 4:46 AM
    Hey folks, so I'm getting to grips with WireMock, I'm using the Java version 3.12.1 in a Kotlin project with the GraphQL extension. The thing I'm having trouble with is the
    BackingStore
    . I've read that it is specified in the options when we initialise a WireMockServer like this:
    Copy code
    WireMockConfiguration config = WireMockConfiguration.options()
        .port(8080)
        .backingStore(new FileBasedBackingStore("wiremock_data"));
    WireMockServer wireMockServer = new WireMockServer(config);
    wireMockServer.start();
    Where the
    FileBasedBackingStore
    is imported from here:
    com.github.tomakehurst.wiremock.store.file.FileBasedBackingStore
    . However the package structure has changed since then. Is the BackingStore no longer a thing? Best wishes and many thanks in advance.
    l
    t
    • 3
    • 8
  • a

    Andreas Winter

    05/06/2025, 11:28 AM
    Hello everyone. I have following setup. While this works fine for a keystore with just one keypair inside, it does not when my keystore has multiple values. I dont find a way to configure, which alias to choose. I already wanted to create a Merge Request for it but I cant build it. So question first here: Is there currently really no way to configure the alias to choose from a keystore? Actually keystores are used to store multiple keys, arent they?
    Copy code
    wireMockConfig()
    .[...]
    .keystorePath(<somePath>)
    .keystoreType(KEYSTORE_TYPE)
    .keystorePassword(KEYSTORE_PASSWORD)
  • r

    Ravi Shankar Reddy Kanakaveedu

    05/08/2025, 10:26 AM
    Hello, We are using Spring Boot. For integration Testing we are using Cucumber with WireMock. We want to implement recording and playback feature in our integration tests. We have our mocks added to
    mappings
    and
    __files
    folders. When
    Recording
    is enabled we could see actual API call is being made and
    recordings/stubMappings
    are saved in
    mappings
    and
    __files
    , but we want to update existing
    mappings
    instead of creating
    new files in mappings and __files
    folder. Can someone let us know if it is possible?
  • r

    rishi

    05/09/2025, 4:11 AM
    Hello, I need to start a wm server using standalone jar, along with it I have to add the behavior of wm extensions to the same server. But I cannot use custom extension jar as the remote machine I am using doesn't allow custom jars to be stored in it for security reasons. I'm currently exploring the ways to add extensions without using the jar (by using .class files or something) Can someone help me with this?
    t
    t
    • 3
    • 6
  • m

    Manish Arora

    05/12/2025, 10:43 AM
    Hello, How can we mention in request mapping if a query parameter should not be null or mandatory Currently I have defined query parametere like
    Copy code
    "urlPathPattern": "/v3/item*",
    "queryParameters": {
      "item": {
        "doesNotMatch": "^00000000[1-2]$"
      }
    }
    but it's also matching with another type of request
    Copy code
    "urlPathPattern": "/v3/item*",
    "queryParameters": {
      "product": {
        "equalTo": "12312321421"
      }
    }
    My understanding is that because in second json request item is null but it's satisfying condition for
    Copy code
    "doesNotMatch": "^00000000[1-2]$"
    which is why wiremock is responding with stub mapped to first reques while ideally it should respond with stub for second mapping. I know with priority this can fixed but in my application already priorities are set and getting messed up. Does wiremock provide anything for such scenario ?
  • a

    Anil Mullamuri

    05/13/2025, 8:31 AM
    Hello, i am using record/ playback, i am recording multiple url's same time, i want a specific url to stop recording based on conditions is there anyway to do it, i am using wiremock standalone 3.10.0 version in spring boot
  • j

    junwei chen

    05/14/2025, 1:44 AM
    Hello, I would like to ask about using WireMock. It uses a proxy to send requests to the target server, but the server has IP restrictions, allowing only certain IPs to access it. Thus, I can't send requests using the WireMock proxy. Is there a way to resolve this issue?