Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Mock a dynamic url #23

Open
didslm opened this issue Nov 15, 2019 · 3 comments
Open

Feature: Mock a dynamic url #23

didslm opened this issue Nov 15, 2019 · 3 comments

Comments

@didslm
Copy link

didslm commented Nov 15, 2019

What if we could mock an endpoint like this /endpoint/product/*
So then it would not matter what parameter we send in the * we would get the same response.

<?php

use donatj\MockWebServer\MockWebServer;
use donatj\MockWebServer\RequestInfo;
use donatj\MockWebServer\Response;

require 'vendor/autoload.php';

$server = new MockWebServer();
$server->start();

$url     = $server->setResponseOfPath("/api/endpoint/product/*", new Response('abc'));
 //request '/api/endpoint/product/1' will result in: abc
@didslm didslm changed the title Mock a dynamic url Not an issue: Mock a dynamic url Nov 15, 2019
@donatj
Copy link
Owner

donatj commented Nov 15, 2019

I think this would be a useful feature to have.

Off the top of my head I'm not sure a great way to implement it but I will certainly look into it.

@itsjavi
Copy link

itsjavi commented Aug 2, 2021

It would be very helpful. Having HTTP 200 responses when something is not mocked is not ideal.

@donatj donatj changed the title Not an issue: Mock a dynamic url Feature: Mock a dynamic url Jul 20, 2022
@donatj
Copy link
Owner

donatj commented May 9, 2024

@ellipsis-dev can you give this a shot?

ellipsis-dev bot added a commit that referenced this issue May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants