lbussy / LCBUrl

Arduino library for handling URLs
MIT License
7 stars 1 forks source link

getAfterPath() was changed from public to private #42

Closed thorrak closed 2 years ago

thorrak commented 2 years ago

Commit https://github.com/lbussy/LCBUrl/commit/0c86cc7cbc9d1901648a0d485da38afa0590cc18 changed getAfterPath() from being public to private. This was a breaking change, as getAfterPath is used in TiltBridge.

This is actually quite helpful when manually constructing HTTP requests, and thus would be helpful to be public.

thorrak commented 2 years ago

This is fixed by #43

lbussy commented 2 years ago

You should have read my mind.

lbussy commented 2 years ago

Okay I've compromised: I've marked this as deprecated but left it as public. In the future you should be able to concatenate what you need from the RFC 3986 components.

thorrak commented 2 years ago

Here's what I ended up replacing getAfterPath with:

String lcburl_getAfterPath(LCBUrl url) // Get anything after the path
{
    String afterpath = "";

    if (url.getQuery().length() > 0) {
        afterpath = "?" + url.getQuery();
    }

    if (url.getFragment().length() > 0) {
        afterpath = afterpath + "#" + url.getFragment();
    }

    return afterpath;
}

Not sure entirely how I feel about the above, given all the String mutation, but it solves the problem while using non-deprecated interfaces.

lbussy commented 2 years ago

It's not efficient - I'm all ears how to get some more efficiencies out of the library.

thorrak commented 2 years ago

make getAfterPath public. :)

lbussy commented 2 years ago

It is! Says right there, public.

lbussy commented 2 years ago

You talked me into it - 1.1.8 will have this reverted.