Search code examples
spring-restdocs

How to remove port number completely from example curl


I am documenting a web API and I need the curl and httpie examples to be a valid calls to our endpoints. The problem is that the example curl snippet includes a port number and I dont see any way to get rid of it. I see how to set the port number, but I dont see how to get rid of it completely.

Am I missing something? It seems like this would be a common use case.

Thanks in advance for any help!


Solution

  • If you set the port to the value that's the default for the scheme then it will be omitted from the curl snippet (and other snippets that include the URI). The defaults are 80 for http and 443 for https.