invoiceninja / sdk-php

PHP wrapper for Invoice Ninja's REST API
https://www.invoiceninja.com
83 stars 41 forks source link

Handle trailing slash in API url gracefully #76

Closed minorOffense closed 2 years ago

minorOffense commented 2 years ago

The URL set by the API implementer may or may not have a trailing slash. It’d be nice to handle either case smoothly.

A pattern we use relatively regularly:

$url = rtrim($this->getUrl(), '/') . '/' . $uri

Assuming $uri never has the slash. Otherwise just append directly it to the string.

https://github.com/invoiceninja/sdk-php/blob/7a644a50be2b5d24863cc03b01cdf84f62011d6d/src/InvoiceNinja.php#L192

turbo124 commented 2 years ago

78