Commit 674a48a
Patrick Mueller
don't parse url for getServiceURL unless required
fixes #21
Turns out the following is not always true:
```js
url.format(url.parse(SomeURL)) == SomeURL
```
At least when the protocol isn't `http:` or `https:`. cfenv expects this
to be true in `getServiceURL()`, when using the replacements argument. It
seems to break for some example mongodb urls, like the one added to the
test in this commit.
Fix for now is that if there aren't any replacement values, then return early
with the currently calculated URL. So it would still break if you passed
one of these not-parsed-correctly URLs and replacements, but the odds of that
seem pretty slim.
Also noticed that `url.format()`` must be standardizing URLs to return them with
a trailing `/` if there was no other path. So now you don't always get that
trailing `/`. Seems survivable.1 parent 6a95b8b commit 674a48a
5 files changed
Lines changed: 24 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
193 | 203 | | |
194 | 204 | | |
195 | 205 | | |
| |||
294 | 304 | | |
295 | 305 | | |
296 | 306 | | |
297 | | - | |
| 307 | + | |
298 | 308 | | |
299 | 309 | | |
300 | 310 | | |
| |||
0 commit comments