Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 12 05:10

    dependabot[bot] on github_actions

    Bump actions/checkout from 2 to… (compare)

  • May 12 05:10
    dependabot[bot] labeled #1024
  • May 12 05:10
    dependabot[bot] labeled #1024
  • May 12 05:10
    dependabot[bot] opened #1024
  • May 10 14:50
    cchangenot opened #1023
  • May 10 13:10
    shaaraddalvi commented #839
  • May 05 05:54
    wjs0702cn edited #1011
  • May 05 05:52
    wjs0702cn synchronize #1011
  • Apr 29 14:09
    marcust opened #1022
  • Apr 28 17:33
    alexbalak21 opened #1021
  • Apr 27 12:06
    saharemanish commented #943
  • Apr 27 11:42
    fullkomnun commented #943
  • Apr 27 11:15
    saharemanish commented #943
  • Apr 21 15:55
    findusl commented #470
  • Apr 19 06:22
    hummelfe94 edited #1020
  • Apr 19 06:21
    hummelfe94 commented #1020
  • Apr 19 06:20
    hummelfe94 edited #1020
  • Apr 19 06:18
    hummelfe94 edited #1020
  • Apr 19 06:16
    hummelfe94 opened #1020
  • Apr 17 04:27
    Seenivasanseeni commented #839
vivekmalhotragithub
@vivekmalhotragithub
hi I created an expectation that mock-server gets a POST request with a gzipped body but when i actually send it a gzipped body the expectation fails. I also dont see my content-type : gzip header in mock-server logs. Is it because mock-server automatically unzips the body ?
Hem Chand
@versatile-hem

0

I am facing an issue in apache http configuration.

Requirement :

A request has land on apache with some header.

for example :

Header myToken

Url https://localhost/fetch-r

Response new Url https://localhost/fetch-r?id=myToken

How can i achieve this in Apache Http 2.4 ?

can any one help me here ?
James D Bloom
@jamesdbloom
@raniello This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@jubui This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@vivekmalhotragithub This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@versatile-hem This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@/all This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
kapokmi
@kapokmi

@here, For an integration test, I am running 5 services, mocked using mockserver by spinning them up with docker compose. Here is my docker compose file:

version: "3.7"
services:
  order-management-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    command: -logLevel DEBUG -serverPort 1080
    ports:
      - ${ORDER_MGMT_PORT}:1080
    networks:
      - default
  location-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${LOCATION_PORT}:1080
    networks:
      - default
  availability-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${AVAILABILITY_PORT}:1080
    networks:
      - default
  supplier-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${SUPPLIER_PORT}:1080
    networks:
      - default
  content-webapp:
    image: mockserver/mockserver:mockserver-5.10.0
    ports:
      - ${CONTENT_PORT}:1080
    networks:
      - default

networks:
  default:
    name: integration-test-network

I would like to get the logs of order-management-webapp for which I have increased the log level. How can I do that please?
The mockserver doc does not provide any details on getting logs when using docker-compose and I am very new to Mockserver. Thanks in advance for your answers!

James D Bloom
@jamesdbloom
@kapokmi This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@kapokmi the logs get printed out on the console so your’l need to look at the console logs for that container using docker-compose
sarut0bi
@sarut0bi
hi, i am using mockServer.mockServerClient javascript client, my instance of mockserver is running behind an api proxy which needs extra authentification header, any way to use the javascript client in this case?
James D Bloom
@jamesdbloom
@sarut0bi This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@sarut0bi I think the setDefaultHeaders() function on the client should allow you to do what you need to set some default headers for proxy authentication
Java Auto QA Tools
@jaqat
изображение.png
Hi all. There is a problem with cast RequestDefinition to HttpRequest in latest Java Client lib
James D Bloom
@jamesdbloom
@jaqat This chat group has migrated to Slack if you would like to join the new Slack group please use the following link https://join-mock-server-slack.herokuapp.com/
@jaqat you can't cast an array in java, you need to do something like the following Arrays.stream(requests).map(HttpRequest.class::cast).toArray(HttpRequest[]::new)
Paul Fortin
@pfortin-urbn
I need to take the input request parse it and use some of that data in the response. I have not seen any examples of how to do that I was wondering if there is one or oen could be provided please?
Paul Fortin
@pfortin-urbn
BTW I am using python/tavern to test my APIs with mock server and the API creates some data and passes it to mockserver which will use it to create a response...
Fabien DUMINY
@fduminy
hi all
Fabien DUMINY
@fduminy
I am trying to record request and response of a REST server. I ran command "mvn -Dmockserver.serverPort=1080 -Dmockserver.proxyRemoteHost=8060 -Dmockserver.logLevel=INFO org.mock-server:mockserver-maven-plugin:5.11.1:runForked" and can browse "http://127.0.0.1:1080/mockserver/dashboard". But I can't call my webservice replacing only the port by 1080 in the URL. What's wrong ?
for example, when using http://127.0.0.1:1080/Api/swagger-ui.html instead of http://127.0.0.1:8060/Api/swagger-ui.html I got a 404 error
Fabien DUMINY
@fduminy
in the dashboard, I see my request in received request panel and I see "NO_MATCH_RESPONSE" in the log panel. any idea what's the problem ?
Fabien DUMINY
@fduminy
I found the problem : I was setting proxyRemoteHost instead of proxyRemotePort
Fabien DUMINY
@fduminy
hi all
Fabien DUMINY
@fduminy
I captured requests and responses and saved it as a json. I would like to verify that actual request and responses matches with java code : I call initializationJsonPath(expectations) and call the WS to test. I modified the json file of expectations but that still match actual requests/responses
Fabien DUMINY
@fduminy
I see that activeExpectation is empty. It's like if my file wasn't loaded despite I see "loading JSON initialization file: "mockserverInitialization.json" in the logs
Fabien DUMINY
@fduminy
Hi @jamesdbloom. Do you have an example showing how to run mockserver both as a proxy and as a verifier using a json file with expected request & response ?
DenisSerebryansky
@DenisSerebryansky

Hi guys

My goal is to setup HTTP server mock in code and then reach this mocked server from remote (in my case from within docker container).
After start of my mocked server (startClientAndServer(1180)) I can reach it from local host machine, but not from remote (curl -XGET http://host.docker.internal:1180/ from within container leads to "Connection refused" error, whereas I can easily reach another service launched on my host machine)

How should I configure my mock-server in order to make it available from remote?

Wagner Caetano
@WagnerCaetano
Hey Guys,
i want to know if there's a way of converting the requests body charsets from retrieveRecordRequests because those body are in a different charset that i'm comparing , for example the expect is às and the incoming is à s and my request is being made as expected. (Btw i updated mock server version , it was on 5.6.1 now it's on 5.11.0 and use to work well on 5.6.1)
angus
@dangus21
is there a way to set required queryParameters?
manjeet1987
@manjeet1987

Hi Guys,

Can anyone please tell me How can I create POST request expectations with JSONPATH with multiple fields in request body.

I am able to create expectation for get end point but not sure How I can call endpoint for post request with multiple fields with JsonPath or any other way to create it.


My Post request that I want call in postman.
http://localhost:8080/api/xyz?simulation=false
Body:
{
"alias": "Mister XYZ",
"accountId": "BE122",
"accountType": "IBAN", //this is ENUM
"address": {
"countryCode": "BE"
}
}


And for this I am creating expectation like below
( It created successfully with 201 created ):

PUT: http://localhost:8080/mockserver/expectation
Body:
"httpRequest": {
"path": "/api/xyz",
"method": "POST",
"queryStringParameters": {
"?simulation": ["false"]
},
"headers": {
"Content-Type" : [ "application/json" ],
"Authorization": ["Bearer .+"]
},
"body": [
{
"type": "JSON_PATH",
"jsonPath": "$[?(@.['alias'] == 'Mister XYZ')]"
},
{
"type": "JSON_PATH",
"jsonPath": "$[?(@.['accountId'] == 'BE122')]"
},
{
"type": "JSON_PATH",
"jsonPath": "$[?(@.['accountType'] =~ /(IBAN|BAN|BBAN|OTHER)/)]" //these are ENUMs
}
{
"type": "JSON_PATH",
"jsonPath": "$.['address'].[?(@.['countryCode'] == 'BE')]"
}
]
},
"httpResponse": {
"statusCode": 201,
"headers": {
"Content-Type": ["application/json"]
},
"body": {
"id": "5a0eaf2012a9a12f1c98947a"
}
}
}

Also give me some solution for ENUM type of fields like accountType in above request. How can I handle it?

Please let me know if you want more clarification on this problem.

Inês Moreira
@simoreira
hey @jamesdbloom, quick question: is it possible to delete expectations by id with the mockserver javascript client?
Ghost
@ghost~55aad2398a7b72f55c3fc7ff
Hi all, I'm having some trouble with my expectations not aligning with what I want. I have my mock server set to respond with mock data when requested on 4 different paths, all GET requests. But for some reason the path it expects turns out to be different from the path it gets every time causing it to fail, but there's no way for me to figure out why its contacting the wrong path in the first place
org.mockserver.logging.MockServerLogger [MockServer-EventLog0] INFO  13030 request:

  {
    "method" : "GET",
    "path" : "/services/rest/server/containers/test_1.0.0/processes",
    "queryStringParameters" : {
      "pageSize" : [ "1000" ],
      "page" : [ "0" ],
      "sortOrder" : [ "true" ]
    },
    "headers" : {
      "Host" : [ "localhost:13030" ],
      "Connection" : [ "Keep-Alive" ],
      "User-Agent" : [ "Apache-HttpClient/4.5.12 (Java/15.0.1)" ],
      "Accept-Encoding" : [ "gzip,deflate" ],
      "content-length" : [ "0" ]
    },
    "keepAlive" : true,
    "secure" : true
  }

 didn't match expectation:

  {
    "id" : "ffce78dc-60a3-4022-af3a-290049ce251b",
    "priority" : 0,
    "httpRequest" : {
      "method" : "GET",
      "path" : "/services/rest/server/containers/test_1.0.0/processes/instances",
      "queryStringParameters" : {
        "page" : [ "0" ],
        "status" : [ "1" ],
        "pageSize" : [ "1000" ],
        "sortOrder" : [ "true" ]
      }
    },
    "times" : {
      "unlimited" : true
    },
    "timeToLive" : {
      "unlimited" : true
    },
    "httpResponse" : {
      "statusCode" : 200,
      "headers" : {
        "content-type" : [ "application/json" ]
      },
      "body" : ...
the paths seem to be mismatched but I have no idea why
Lucas
@j-lucas-d
Hi. A question for the room; I need to configure a mock-server with multiple expectations, which all use the same path. They have different HTTP methods and URL parameters. From my testing, it seems the mock server is only keeping the last expectation. Is there a way to have them all configured?
Marco Schmitz
@DaRolla
Hi there, I have a question myself.
I need to parse the request, get a field, and post it into the response. I do not think that I am the first person who needs this...
I am using JavaScript all the way, so I do want to stay in my convenience zone.
The only way I found was to use Java and a Callback thingy...
geokh77
@geokh77
Hi, new to Mock-server want to use as standalone server for a node.js project. Any suggestions where to start/good best practice example? Thanks in advance
akoni2012
@akoni2012
Hi. I am having some problems with some component tests which use the mock server. With mockserver-netty v5.6.1, I am able to execute a simple test which uses TestRestTemplate to Post data to an endpoint and get back OK status. From v5.7.0, I am getting back a 500 Internal Server Error. Please can someone direct me to a page that holds the changes/fixes for each release so that I may get the needed information to fix my tests? Otherwise, if this rings familiar to you, please advise accordingly. Many thanks in advance.
sateeshd7
@sateeshd7
Hi All, I am trying to start a Mock server as a windows service and the mock server is started but service is throwing an error as below. Is there any other way to start it as windows service:
cmd /c java.exe -jar mockserver-netty-5.11.1-jar-with-dependencies.jar -serverPort 3002
image.png
Steven Katabalwa
@StevenKatabalwa
Hi, How do I pass response body variables from a JSON specification file?
jastiv
@jastiv
Hi, Please suggest is it possible to use open api v2.0 with mock server
jastiv
@jastiv
Hi, I want to configure latency and scalability in my mock using nodejs. Is there any example available for the same?
SeenivasanSeeni
@Seenivasanseeni

Hi. there. forward is not working.
ClientAndServer clientAndServer = new ClientAndServer(port);

                .when(
                        request()
                ).forward(
                forward()
                        .withHost("www.google.com")
                        .withPort(443)
                        .withScheme(HttpForward.Scheme.HTTPS)
        );

and then when I hit at "localhost:2018/", instead of going to google search engine. i am getting 404.
Same thing is happening when trying to forward the request to facebook.com or graph.facebook.com

Patrick
@patrickjamesbarry
Is there are way to filter what is recorded in mockserver. We really like the capturing feature, however, we only want it to apply to certain matching criteria.