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

http-server: use strings.Trimspace instead of slicing #283

Merged
merged 1 commit into from
Nov 3, 2019

Conversation

nicnicknicky
Copy link
Contributor

What I Did

Change all instances of player := r.URL.Path[len("/players/"):] to player := strings.TrimPrefix(r.URL.Path, "/players/")

using strings.Trimspace similarly to how the http package source code does it:
https://golang.org/src/net/http/server.go?#L2040

@quii
Copy link
Owner

quii commented Nov 3, 2019

Nice! Didn't know about that

@quii quii merged commit 11a6a72 into quii:master Nov 3, 2019
arkanjoms pushed a commit to arkanjoms/learn-go-with-tests that referenced this pull request Nov 4, 2019
voelzmo added a commit to voelzmo/learn-go-with-tests that referenced this pull request Jun 4, 2021
This was changed with quii#283 in the previous chapter. Following through with this change in the json chapter to stay consistent.
voelzmo added a commit to voelzmo/learn-go-with-tests that referenced this pull request Jun 9, 2021
This was changed with quii#283 in the previous chapter. Following through with this change in the json chapter to stay consistent.
quii pushed a commit that referenced this pull request Jun 10, 2021
* Adapt player name extraction in json chapter

This was changed with #283 in the previous chapter. Following through with this change in the json chapter to stay consistent.

* Adapt player name extraction in io chapter

* Adapt player name extraction in cmdline chapter

* Adapt player name restriction in time chapter

* Adapt player name extraction in websocket chapter
gypsydave5 pushed a commit to gypsydave5/learn-go-with-tests that referenced this pull request Jun 11, 2021
* Adapt player name extraction in json chapter

This was changed with quii#283 in the previous chapter. Following through with this change in the json chapter to stay consistent.

* Adapt player name extraction in io chapter

* Adapt player name extraction in cmdline chapter

* Adapt player name restriction in time chapter

* Adapt player name extraction in websocket chapter
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.

2 participants