Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for string interpolation to URI #2442

Merged
merged 3 commits into from Jul 16, 2020

Conversation

dimitribouniol
Copy link
Contributor

@dimitribouniol dimitribouniol commented Jul 15, 2020

Enables call sites that use URIs to allow for string literals that make use of interpolation (#2442).

app.get("hello") { req -> EventLoopFuture<String> in
    return req.client.get("\(Constants.basePath)/status")
    .flatMapThrowing { res throws in
        return "Hello, world!"
    }
}

@MrLotU MrLotU requested a review from tanner0101 July 16, 2020 08:44
Copy link
Sponsor Member

@MrLotU MrLotU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a problem with this. CC @tanner0101, was there a specific reason not to do this? :)

Copy link
Sponsor Member

@MrLotU MrLotU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a problem with this. CC @tanner0101, was there a specific reason not to do this? :)

@tanner0101 tanner0101 added the enhancement New feature or request label Jul 16, 2020
@tanner0101 tanner0101 added this to Awaiting Review in Vapor 4 via automation Jul 16, 2020
Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @dimitribouniol. Two things:

@tanner0101 tanner0101 added the semver-minor Contains new API label Jul 16, 2020
@tanner0101 tanner0101 moved this from Awaiting Review to Awaiting Updates in Vapor 4 Jul 16, 2020
@dimitribouniol dimitribouniol changed the title Allow string interpolation wherever URIs are supported Add support for string interpolation to URI Jul 16, 2020
@dimitribouniol
Copy link
Contributor Author

@tanner0101 I've added to an existing test for URI parsing (for string interpolation too), and reformatted the PR's title and body. Please let me know if it needs any more changes! (I'll do the same to vapor/routing-kit#101 since it's pretty much the same PR, but for PathComponent)

Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

@tanner0101 tanner0101 merged commit 6a552c6 into vapor:master Jul 16, 2020
Vapor 4 automation moved this from Awaiting Updates to Done Jul 16, 2020
@tanner0101
Copy link
Member

These changes are now available in 4.23.0

@dimitribouniol
Copy link
Contributor Author

@tanner0101 Thank you!

@dimitribouniol dimitribouniol deleted the pathing-quality-of-life branch July 16, 2020 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver-minor Contains new API
Projects
Vapor 4
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants