This middleware makes it much easier to write sub-routes, allowing you
to make the sub-router ignorant of its parent router's matched prefix.
The example app has also been modified to use this functionality for its
admin pages.
Fixes#65.
This is a breaking API change that changes how wildcard patterns are
treated. In particular, wildcards are no longer allowed to appear at
arbitrary places in the URL, and are only allowed to appear immediately
after a path separator. This change effectively changes the wildcard
sigil from "*" to "/*".
Users who use wildcard routes like "/hello*" will have to switch to
regular expression based routes to preserve the old semantics.
The motivation for this change is that it allows the router to publish a
special "tail" key which represents the unmatched portion of the URL.
This is placed into URLParams under the key "*", and includes a leading
"/" to make it easier to write sub-routers.
This allows you to match "/a/cat.gif" with patterns like "/a/:b.:c".
Thanks to @Minecrell for an early patch implementing this functionality.
Fixes#75.
Fixes#48.
this method actually returns RepositoryCommits (go-github's term for
this, not GitHub's) rather than Commits. They are very, very close in
structure (which is likely why this has gone unnoticed for so long), one
of the primary differences being that RepositoryCommits exposes the
GitHub identity of the commit author and committer if possible.
Make the bytecode runner return the route that we're going to use. It's
up to the router itself to dispatch to that route.
Besides feeling a teensy bit cleaner, this refactoring is to prepare for
a "Router" middleware, which will allow application developers to
control when in the middleware stack routing occurs.
I originally exposed Compile() for exactly this use case, but apparently
I never actually implemented this. Oops.
In any event, this makes the first request a little faster (an extremely
unscientific test suggests on the order of 10 microseconds). Also, if
something goes terribly wrong during route compilation, it would fail
before we start listening on the socket.
Instead of using struct embedding to build web.Mux, start moving towards
explicit mappings. This doesn't actually change the public API of
web.Mux, but feels a little cleaner to me.
The longer-term thing here is to get rid of the functions defined on
Muxes in the public documentation that are defined on "rt *Mux", which
is just plain ugly.
These changes are strictly violations of any style guide (I don't
think?), but are just to make tests in go-github more consistent,
particularly in use of 'got' and 'want' vars. In doing this, I found
several places where those two got reversed in the error message (hint:
'got' always comes first in go)
okay, so these aren't really that useful buy hey, why not? :)
MMM. .MMM
MMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMM __________
MMMMMMMMMMMMMMMMMMMMM | |
MMMMMMMMMMMMMMMMMMMMMMM | Ship It! |
MMMMMMMMMMMMMMMMMMMMMMMM |_ ______|
MMMM::- -:::::::- -::MMMM |/
MM~:~ ~:::::~ ~:~MM
.. MMMMM::. .::::. .::MMMMM ..
.MM::::: ._. :::::MM.
MMMM;:::::;MMMM
-MM MMMMMMM
^ M+ MMMMMMMMM
MMMMMMM MM MM MM
MM MM MM MM
MM MM MM MM
.~~MM~MM~MM~MM~~.
~~~~MM:~MM~~~MM~:MM~~~~
~~~~~~==~==~~~==~==~~~~~~
~~~~~~==~==~==~==~~~~~~
:~==~==~==~==~~
A recent update to the GitHub API changed some undocumented behavior. Previously
a nonexistent base_tree and an empty string base_tree were treated the same, but
now the empty string case will fail with "422 base_tree is not a valid oid".
The release assets are included in the release object, but they are not being
parsed currently. To get the list of release assets, one must use
ListReleaseAssets, which is one extra unnecessary HTTP request.
This commit adds Assets field to RepositoryRelease struct so that the release
assets are immediately available right after calling ListReleases.
Signed-off-by: Ondřej Kupka <ondra.cap@gmail.com>
This is meant to accomplish a few things:
1. graceful no longer spawns an additional goroutine per connection.
Instead, it maintains a sharded set of idle connections that a single
reaper goroutine can go through when necessary.
2. graceful's connection struct has a more orthogonal set of connection
state flags, replacing the harder-to-understand state machine. The
underlying mechanics are largely the same, however.
3. graceful now uses the Go 1.3 ConnState API to avoid the "200-year
SetReadDeadline hack." It still falls back on SetReadDeadline on Go
1.2 or where ConnState does not apply.
The git ref methods were mostly written to not expect the 'refs/' prefix
on ref names, even though it is included the ref.Ref value returned by
GitHub. This resulted in ref values returned from some methods that
couldn't be passed to other methods. In reality, ref names passed to
these methods should normally include the prefix, but this change
supports either form for backwards compatibility.
Fixes#133
This feature can be used in place of the pile of hacks in middleware.go,
and doesn't involve awkwardly shimming out a http.ResponseWriter. Sounds
like a win-win!