in a way it will work in a Swagger UI. I've even tried making a lens so it can fit in to the
ContractRoute
definition, like:
Copy code
val restLens = Path.regex(".*").of("rest")
val route = "pattern" / restLens
But it just results in a 404.
Has anyone ever gotten this to work with Swagger UI?
Andrew O'Hara
07/21/2022, 9:03 PM
Ah, it came to me immediately after posting. This lens works:
Copy code
val restLens = Path.string().of("rest:.*")
d
dave
07/21/2022, 9:11 PM
wow! I absolutely 100% thought that would not work! Thank you for the lesson! 🤣
a
Andrew O'Hara
07/21/2022, 10:05 PM
Maybe it's entirely coincidental that the implementation allows the greediness. I should maybe add a test to ensure it doesn't get broken by accident.
a
Arnab
07/21/2022, 11:10 PM
Out of curiosity, what's the use case here? It's always interesting to look at the use cases behind these things :)
a
Andrew O'Hara
07/22/2022, 7:52 PM
We've got some old weird proxies that need to be maintained. They're used to communicate to IOT devices that maintain a persistent connection with us.
Instead of setting an HTTP proxy in our requests, I have to maintain a connection format like:
Copy code
http://<proxy-host>/<device-token>/<target-uri>
where the
device-token
is used to lookup the IOT device's connection. We get the connection, and then send the device something like
Copy code
<http://localhost/><target-uri>
In most cases, we're actually communicating a custom TCP protocol, but the HTTP request above illustrates the point.