Angular4 karma proxy wildcard

Viewed 945

I have my api running on a server myserver.com:4567/api and I want every request from my angular app to go here when it matches /api/*. I've set this up already using a proxy-conf.json and it works perfectly for serving. However I want to test my application with karma, and it doesn't seem to accept wildcards for proxies.

How can I solve this without providing karma every possible endpoint

I want this:

proxies: {
  "/api/*": "http://mybackend.com:4567"
}

instead of this:

proxies: {
  "/api/1": "http://mybackend.com:4567/api/1"
  "/api/2": "http://mybackend.com:4567/api/2"
  "/api/3": "http://mybackend.com:4567/api/3"
  "/api/4": "http://mybackend.com:4567/api/4"
}
1 Answers
Related