Api base path not respected on Test Request UI

(Arie Gofer) #1

Let’s say I have an API defined with ‘base path’ as “/v1” and ‘api host’ empty.
And the host environment variable env.host is “http://example.com
In this case, the top of the API page in read mode will show the host as: http://example.com/v1
So far so good.

But when I go to the “Send Test Request” part of the API, the URL which it tries to call is http://example.com without the /v1. If I add the /v1 to env.host, then the Send Test Request works great, but the API page shows

Am I missing anything ? Any reason the path is not part of the request URL?
Thanks !

(Taylor Barnett) #2

I’m guessing you are seeing something like this:

Looks like a bug to me too. Opening up a ticket for this internally right now.

(Arie Gofer) #3

yep. Expecting to see also the base path there.
Thanks !

(Taylor Barnett) #4

What happens when you put {$$.env.host} in the host field? It is a required field, which is why it might be happening.

(Arie Gofer) #5

It is mandatory, but as the tooltip says - it has a default. Unlike what it says - it does not take the actual documentation host but rather the environment host value - as I would expect :slight_smile:

However I already tried what you suggested, and got the following error:
I guess it does not like the curly braces.

(Taylor Barnett) #6

This is a separate bug we are working on. You can ignore that error for now.

(Arie Gofer) #7

In any case, on a published hub, the behavior is the same - the path twice on the API page.

(Taylor Barnett) #8

I’ve opened up an issue for this internally. One thing I did notice was that if you do {$$.env.host}, it at least includes “http://” which does not happen when you leave it blank.