https://linen.dev logo
Join the conversationJoin Slack
Channels
announcements
cdk-avengers
general
introduce-yourself
random
setup
wiremock-cloud
wiremock-open-source
wiremock-studio
Powered by Linen
general
  • n

    Norman Mahendra

    03/16/2023, 8:57 AM
    Hi everyone, is there a possibility to use
    postServeAction
    with the webhook extension and also include a transformer? I am working with json mappings. One use case for this is we want to generate an auth token for the callback. Right now as a workaround I am using
    StubRequestFilter
    to enrich the originalRequest with the token I want and fetch this in the postServeAction via originalRequest.header, as a caveat this is applied to all mappings (at least from the documentation I don't see how to choose a stubbing and not globally) Now we would also like to calculate a field based on some secret. If this was a simple response a responseTransformer would do the trick but it seems like postServeAction + webhook don't directly support this?
    t
    • 2
    • 1
  • n

    Nicolas Homble

    03/16/2023, 5:07 PM
    hey folks, is the wiremock org in dockerhub affected by this communication?
    t
    o
    • 3
    • 11
  • g

    Giovanny Sayas

    03/17/2023, 12:33 PM
    Hi everyone, is there any way to make sync calls before a mapping resolves? similar to webhook
    postServeAction
    but in a sync fashion instead of async?
  • r

    Rohit Manmath Binjagermath

    03/17/2023, 3:01 PM
    Hello everyone, We have root module having packaging as pom and 2 sub modules where one is existing and the other one added recently. Existing module is spring boot application which has starter class we can say it as main module where required wiremock configuration defined by creating bean. Both modules has __files and mapping folders respectively for requests and mocked responses in josn format. Now when I run application, I can able to access main existing module and able to get correct mocked response but can not able to get the same for new module although I have added new module dependency in existing modules pom.xml file. Can any one help me how can I tell wiremock to scan request and response under __files and mapping folder of new module? Already tried with FileSource not working. Kindly help In this case I am using wiremock-jre8 of 2.28.1 version
    • 1
    • 1
  • o

    Oleg Nenashev

    03/19/2023, 1:39 PM
    FYI WireMock SpringBoot Library just got the 1.0 release https://github.com/maciejwalkowiak/wiremock-spring-boot/releases/tag/v1.0.0
  • t

    Tom

    03/19/2023, 1:50 PM
    That was quick
  • d

    Danny Paniagua

    03/20/2023, 1:31 PM
    Hey! I'm having some trouble setting up my wiremock mapping logic using response templating helpers. I'm trying to understand how to access the request body inside of a
    #eq
    block - whatever I have setup now is always returning with the false condition. The simplified object coming in is
    {
      lender-type: 'installment',
      cuId: '1234'
    }
    The goal is to use response templating to choose which json file to return. I have these sections in my mapping file:
    "bodyPatterns": [{ 
      "mathesJsonPath": "[?($.lenderId == 'installment')]"
    }]
    and then further down:
    "response": {
      "bodyFileName": "{{#eq (jsonPath request.body '$.cuId') '1234'}}respseon_file_A.json{{else}}response_file_B.json{{/eq}}"
    }
    The
    matchesJsonPath
    bit seems to work fine as I know I am getting into this mapping file. The problem I'm running into as stated further up above is that when I try to test this logic, the
    #eq
    block is always returning
    response_file_B.json
    , no matter what
    cuId
    field is getting passed. I'm assuming I have some bad character spacing in the handlebars syntax and not to sure how to debug it. Is there anything obvious that I'm doing wrong?
    ✅ 1
    a
    • 2
    • 12
  • r

    Rohit Manmath Binjagermath

    03/20/2023, 2:26 PM
    How can I use configuration.usingFilesUnderDirectory() to scan wiremock mapping req and response from wiremock folder under resources of another module in multimodule wiremock application, where as this module is added as dependency in main module pom.xml Tried by passing path to directory but it is not working
    t
    • 2
    • 2
  • o

    Oleg Nenashev

    03/20/2023, 7:42 PM
    Just noticed on the network - Meetup/Workshop in the Netherlands on Mar 29: https://www.meetup.com/innovative-test-automation-nl/events/291682690/
  • r

    Rajesh Narayanappa

    03/21/2023, 3:49 AM
    Hi @Tom: We are using wiremock is plain java way. We have used
    usingFilesUnderDirectory
    method to save all files in different path. We observed for responses over 2MB response body was null. On further debugging, we found bigger size responses are going into this method -
    <https://github.com/wiremock/wiremock/blob/master/src/main/java/com/github/tomakehurst/wiremock/recording/SnapshotStubMappingPostProcessor.java#L61>
    . and here rootDirectory is not path given at ``usingFilesUnderDirectory` method. Suspected bug could be at this level as this looks for constant path which is
    __files
    and not user provided path. Looks like this is bug. Please confirm. Pre-cond: • response size is >2MB To overcome this issue, we have extended default bodyTextsize to make sure size condition is not met.
  • m

    Mohamed Amine BERGUIGA

    03/21/2023, 10:21 AM
    Hello, we use wiremock using docker image. We want to rewrite the path /__admin. Can we achieve it with command line. Thank you
    t
    • 2
    • 1
  • l

    Leon Witznick Schumacher

    03/21/2023, 9:14 PM
    SUP, I'm with a problem using the method post: Error: Access to XMLHttpRequest at 'http://localhost:8080/api/v1/project' from origin 'http://localhost:5173' has been blocked by CORS policy { "request": { "method": _"_POST_",_ "urlPath": _"_/api/v1/project_",_ "headers": { "Content-Type": { "equalTo": _"_application/json_"_ } } }, "response": { "status": 200, "bodyFileName": _"_files/project_POST.json_",_ "headers": { "Content-Type": _"_application/json_",_ "Access-Control-Allow-Origin" : _"_*_",_ "Access-Control-Allow-Methods": _"_GET, POST, PUT, DELETE, OPTIONS_"_ }, "fixedDelayMilliseconds": 500 } }
    👀 1
    r
    t
    • 3
    • 5
  • l

    Leon Witznick Schumacher

    03/21/2023, 9:14 PM
    how can i fix this issue
  • l

    Leon Witznick Schumacher

    03/21/2023, 9:14 PM
    ?
  • j

    Jorge Meireles

    03/21/2023, 9:40 PM
    I have the same issue
  • p

    Palak

    03/22/2023, 1:50 PM
    I have recently started working on wiremock. I am working on POST methods. I wanted to know how we can get default response if the selection criteria is not matching any of the existing mappings? This is my mapping file for matching 12345 id, what change to make if we want to make it generic ..like any id and it should respond with the file which we map for. { "id" : "123", "name" : "xyz", "request" : { "url" : "xyz", "method" : "POST", "bodyPatterns" : [ { "matchesXPath": { "expression": "abc/id/text()", "equalTo": "12345" } } ] }, "response" : { "status" : 200, "bodyFileName": "xyz/Success_default-rsp.txt", "headers" : { "Content-Type" : "text/xml;charset=UTF-8", "X-Backside-Transport" : "OK" } }, "uuid" : "123097", "persistent" : true, "insertionIndex" : 2 }
    a
    • 2
    • 4
  • r

    Rania Zouari

    03/22/2023, 3:43 PM
    hello I'm Rania from Tunisia, I'm just trying Wiremock and I would like to know if the number of caracters in requestUrl in wiremock is limited or not ? (modifié)
    t
    • 2
    • 3
  • v

    Vasu

    03/22/2023, 4:12 PM
    I am running wiremock as a standalone docker container. When logs are forwarded to kibana, it shows up as below which is less than preferred. is there any way we could change the logging format to JSON or any other suggestions
    t
    • 2
    • 6
  • r

    Rohit Manmath Binjagermath

    03/23/2023, 5:20 AM
    Can anyone suggest or anyone had worked on consuming graphql request in wiremck spring boot application, how can we define bodyPatterns like we do for json using matchesJsonPath?
    a
    • 2
    • 1
  • r

    Ramya Vedagiri

    03/23/2023, 9:36 AM
    Hi. I am trying to find a way to mock protobuf response. I have a json mapping. Want to convert that as protobuf response.
    t
    • 2
    • 11
  • t

    Tomas Belda

    03/23/2023, 3:23 PM
    Hello everybody I would like to intercept a request ( for example https://google.com) and return the mocked value response ( for example "hello world ") is possible to do that intercept? thanks everybody
    t
    • 2
    • 1
  • t

    Tom

    03/23/2023, 4:56 PM
    https://wiremock-community.slack.com/archives/C04JE0AFE76/p1679590583141039
  • p

    Preethu Kg

    03/23/2023, 9:53 PM
    Hey! it would be great help if anyone can help me with graphql mock service implementation using Wiremock. I have couple of operations and type of requests using graphql but when I try to do request validation using bodyPatterns it is not working
    r
    • 2
    • 1
  • o

    Oleg Nenashev

    03/24/2023, 1:28 PM
    Hi all. I am about to give a talk on WireMock in Switzerland next month. Was about printing a few t-shirts like this one (with fancy JSON coloring). Would somebody be interested in getting such T-shirts? Maybe I could print a few extras or share the sources :)
    t
    • 2
    • 7
  • m

    Mikeismynick Smith

    03/25/2023, 9:51 AM
    hey there! i have question, how can i test that endpoint receive exact array of string query params ? e.g. has two values and want to test that i recive it in any order
  • m

    Mikeismynick Smith

    03/25/2023, 9:52 AM
    GET /method?param=UAVTVD&param=UAVTVZ
  • o

    Oleg Nenashev

    03/25/2023, 11:32 AM
    Hi there! I plan to help a bit with the community side of WireMock :wiremock: As discussed with Tom, just launched the Twitter account: https://twitter.com/wiremockorg . Mastodon & Co are coming soon, and any posts on WireMock will be always appreciated!
    🙌 3
  • s

    sidi amine bouhamidi

    03/26/2023, 9:02 PM
    Hi there! I am using the dockerized version of wiremock, everything working well except the response templating
    {{now}}
    . I looked everywhere to find out how to activate it. Could you please help me? • How I start the container :
    docker run -itd --rm -p 9000:8080 --name wiremock -v $PWD/mocks:/home/wiremock wiremock/wiremock
    • My Stub in
    $PWD/mocks/stub-get-session-200.json
    {
      "request": {
        "method": "GET",
        "url": "/api/v1/session"
      },
      "response": {
        "status": 200,
        "jsonBody": {
          "expiresAt": "{{now offset='900 seconds'}}"
        },
        "transformers": [
          "response-template"
        ],
        "headers": {
          "Content-Type": "application/json"
        }
      }
    }
    • The response when I call the API
    <http://localhost:9000/api/v1/session>
    {
      "expiresAt": "{{now offset='900 seconds'}}"
    }
    t
    • 2
    • 1
  • a

    Albert Vesker

    03/27/2023, 2:43 PM
    Hi. I use cucumber + java. I want create Scenario test-case and I don't want to create 2+ mock responses where changes just 1 field in the mock-response. What do u suggest to do?
    t
    • 2
    • 6
  • a

    Albert Vesker

    03/27/2023, 2:44 PM
    Another question: I can't understant how to use https://wiremock.org/studio/docs/response-templating/misc-helpers/#assignment at all. For example 'with'. Where in JSON i should assign it? How? Could please give me some json mapping and response examples please? Ty in advance
Powered by Linen
Title
a

Albert Vesker

03/27/2023, 2:44 PM
Another question: I can't understant how to use https://wiremock.org/studio/docs/response-templating/misc-helpers/#assignment at all. For example 'with'. Where in JSON i should assign it? How? Could please give me some json mapping and response examples please? Ty in advance
View count: 1