Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Sep 16 20:33
    yutu3 commented #649
  • Sep 16 20:32
    yutu3 commented #649
  • Sep 16 19:19
    rebelinkedin closed #670
  • Sep 16 19:19
    rebelinkedin commented #670
  • Sep 16 18:59
    rebelinkedin edited #670
  • Sep 16 18:47
    rebelinkedin opened #670
  • Sep 12 13:33
    aturbati opened #669
  • Sep 10 04:46
    GocePetrovski commented #172
  • Sep 09 17:45
    ThibaultPatoux commented #635
  • Sep 09 12:03
    coolxll opened #668
  • Sep 09 06:57
    krisgeus commented #658
  • Sep 09 03:06
    yutu3 commented #649
  • Sep 06 08:31
    vvargas90 opened #667
  • Sep 05 14:45
    sileht commented #662
  • Sep 02 12:48
    wujek-srujek opened #666
  • Aug 28 13:17
    vvargas90 commented #360
  • Aug 27 05:20
    yutu3 commented #649
  • Aug 22 09:35
    greyireland opened #665
  • Aug 22 07:26

    jamesdbloom on master

    added basic support for access-… (compare)

  • Aug 22 07:26
    jamesdbloom closed #664
do we have any recorder facility to find the request??
Can't connect to MockServer running on host: "localhost" and port: "1080"
Jonathan Vila
Hi, is there any option to make MockServer to respond with a file ? for the moment I'm doing : .withBody(IOUtils.toString(EndToEndIT.class.getClassLoader().getResourceAsStream("cloudforms-export-v1.tar.gz"), StandardCharsets.UTF_8)));
Jonathan Vila
Hi, I've trying with a ByteArray , but I still have the same issue
Jonathan Vila
tbh, I dont find the way to download a file
I have a simple expectation :
                        .respond(myrequest -> {
                            try {
                                return response()
                                        .withHeader("Content-Type", "application/zip")
                                        .withBody(new BinaryBody(IOUtils.resourceToByteArray("platform.upload.xavier.json.gz", EndToEndIT.class.getClassLoader())));
                            } catch (IOException e) {
                                return notFoundResponse();
and this is the client
InputStream outputStream = new RestTemplate().postForObject("http://localhost:8000/insights-upload-perm-test2", "", ByteArrayInputStream.class);
        GZIPInputStream gzipInputStream = new GZIPInputStream(outputStream);
        System.out.println(" Descarga : " + IOUtils.toString(gzipInputStream, StandardCharsets.UTF_8));
it complains with : org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [class java.io.ByteArrayInputStream] and content type [application/zip]
Jonathan Vila
        List<HttpMessageConverter<?>> messageConverters = new ArrayList<HttpMessageConverter<?>>();
        messageConverters.add(new ByteArrayHttpMessageConverter());
        HttpHeaders headers = new HttpHeaders();
        HttpEntity<String> entity = new HttpEntity<String>(headers);
        ResponseEntity<byte[]> outputStream = new RestTemplate(messageConverters).exchange("http://localhost:8000/insights-upload-perm-test2", HttpMethod.GET, entity, byte[].class, "1");
        GZIPInputStream gzipInputStream = new GZIPInputStream(new ByteArrayInputStream(outputStream.getBody()));
        System.out.println(" Descarga : " + IOUtils.toString(gzipInputStream, StandardCharsets.UTF_8));
Lasse Benn Nørregaard
@jonathanvila I don’t know how you’re running WireMock, but have you looked at this: http://wiremock.org/docs/stubbing/#file-serving?
Jonathan Vila
Hi @lassebn , I gave up on WireMock because the issues with Spring Boot.... now I'm using mock-server that works perfectly well..... but, I'm having an issue in the way of serving a file
@jamesdbloom I've tried today and if I point my Camel application to download a zip file from internet ( random web page serving a zip file https://file-examples.com/wp-content/uploads/2017/02/zip_2MB.zip ) it works fine with current code, but doing the above approach with mock-server creates some kind of issues on the type conversion
Lasse Benn Nørregaard
@jonathanvila Sorry, I confused myself thinking this channel was for WireMock.
Jonathan Vila
Jonathan Vila
@jamesdbloom Fixed..... I have added (and calculated) the Content-length header and everything worked fine. :)
Do i need to do anything special to get the UI to work? I go to http://localhost:1080/mockserver/dashboard and don't see any of the logs/active expectations/etc.
Tim Dolgov
I have a problem help. I do not understand how to make it work! If there are no mocks, so that there is a redirection to normal integration. And if there are mocks to respond to them.
William Lightning
@browerjs The UI only works on https:// and your browser trusts the MockServer CA
@jamesdbloom Is it possible to use org.mockserver.client.initialize.ExpectationInitializer when running the server from the docker container?
nevermind, i was able to get it to work with the server package
Maciej Gunia
hey guys, trying to use mockserver-node alongside mockserver-client on my dev environment it works fine but in docker i get Error: spawn java ENOENT. Do I really need to install java inside the container? I had the impression that the node package should do that for me?
Marko Sertic
Hi, could anyone help me with my question ? I have noticed that when I set mockserver in my test, and uses lets say Future .get() to block execution until i get response from mockserver(because i am using async-http client but i need this part of code to be synchronous ). Test hangs until async-client timeouts. I have also use isDone() method to check if i will ever get response back, but it seems that for some reason mockserver doesn't return anything. Question is why is this happening and if there is a way to avoid such behaviour ? Also when i tried to lets say call real endpoint i Future .get() returns result perfectly fine, but i need wiremock for testing and this kinds of test just hangs until timeout on Future .get() call.
Alex Skrypnyk
Hi, is there a /version or other endpoint that can be used as a probe that the Mockserver is up and running?
@alexdesignworks You can just create an expectation for that, but I do realize the use case for that.
Alex Skrypnyk

yeah, this is what I do - create a GET expectation /selftest and call it. But this means that all helping functions that create such expectations in my framework should work correctly. Having /mockserver/version and CURL'ing it would be a much easier way to make sure that the server is running.

Thank you @Rahul-Bhargav

Hi everyone
i don't know how to run the examples which is available in examples
i ran the jar file using java -jar mockserver-netty-5.6.2-SNAPSHOT-jar-with-dependencies.jar --serverPort 1080 --debugLevel DEBUG
I am having an issue with responses. If my response text has a linefeed between elements, the program will not run:
"httpResponse" : {
"body" : '<test>
If the response is on one line it works. Why?
"httpResponse" : {
"body" : '<test></test>'
i need to response as a json file when trigger http://localhost:1800/api/v1/offlinedata
how to do anyone can help me out?
I used mockserver with maven and it worked fine.
Now I am trying to use mockserver with the testing tool - Cypress
Installed mockserver and mockserver-client through node,npm
But when i try to start the server, it throws TypeError: fs.readdirSync is not a function
But there is no place where i have worked with fileSystem(fs).
code -
it('try with npm node', ()=>{
var mockserver = require('mockserver-node');
verbose: true,
trace: true
console.log("started MockServer");
Can someone help me out with this please
Khushboo Agrawal
Hi I am new to this mock-server . I am trying to implement one request with it . I am able to start the server but when I am trying to HIT the request
Its returning 404
Can someone please help ?
I have raised an issue on github jamesdbloom/mockserver#658 20 days back. I still didn't get any response on it.
Yuriy Olkhovyy
Hi everyone, what's the right way of configuring multiple identical expectations when there are multiple instances of the same test run against a single instance of the MockServer? I am thinking about adding a header with a UUID value, so that the identical expectations do not collide, not sure though if it is the right way of making the identical expectations unique.
Second question - is there a common approach of cleaning up expectations? When a test is finished I'd like to clean all expectations created by that specific test.
Björn Kautler
@kiakimov when you create an expectation, you can say how often it should match, or also to always match.
Hello All, question around mockserver and FIPs. Has anyone gotten this working before? I'm seeing ssl is broken when you try to use FIPs version of bouncycastle with mockserver. Everything else seems fine, but I do not know enough about how all the backend is working to debug this well enough. So any help would be appreciated! Thanks in advance!
I use MVN to start the mock service, then how can I write the expected results of the hot interface if I make java? At present, I see the examples you give here all need to restart a mockserver service. It's very urgent. Please see the reply as soon as possible. Thank you very much!!!
Hello again All, I figured out FIPs on mockserver. I will be making a PR to go to the normal repo to try to alleviate this for anyone who might need to have FIPs working with mockserver. Will take me a few days to get it out there, reach out if anyone needs assistance in the mean time.
Uri Berman
Hi everyone. I'm configuring MockServer as a standalone process through Docker, using the latest version as of today.
I'm configuring a callback based response using the Node MockServer client.
Afterwards, I call the "reset" function of the client. However, it seems like the WebSocket connection created through "mockWithCallback" keeps existing, because my tests runner (Jest) does not exit, complaining about a persistent connection still existing
Has anyone ran into this issue in the past? I found a GitHub issue complaining about the same thing in the Java client, which was solved, but it seems like the same hasn't happened in the Javascript client
Hi Does MockServer support http2.0