Skip to content

Conversation

@willbach
Copy link
Contributor

@willbach willbach commented Feb 15, 2024

Problem

Currently, it is possible to bind an HTTP path in http_server with a URL param like /test/:test-id, but it is not possible to get easy access to :test-id or the path that was originally bound.

Solution

This PR includes the updates to the IncomingHttpRequest, along with additional methods for parsing the bound_path

Docs Update

Corresponding docs PR

Notes

There will be a repo added that can be used to test http bindings and requests.

@willbach willbach force-pushed the wg/incoming_http_updates branch from 6326617 to e14f212 Compare February 15, 2024 16:07
src/http.rs Outdated
Comment on lines 238 to 242
pub fn bound_path(&self, strip_prefix: Option<&str>) -> String {
self.bound_path
.replace(strip_prefix.unwrap_or(""), "")
.replace("//", "/")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

can you please add a docstring here that describes what's going on? i'm confused, so likely others using this function will be too

@willbach willbach merged commit 70cadf9 into develop Feb 15, 2024
@willbach willbach deleted the wg/incoming_http_updates branch February 15, 2024 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants