23 lines
1.1 KiB
Go
23 lines
1.1 KiB
Go
package subsonic
|
|
|
|
// The OpenSubsonic formPost extension requires the server accept API
|
|
// arguments via POST with an application/x-www-form-urlencoded body, in
|
|
// addition to the classic GET query-string form. This needs no
|
|
// dedicated handler: the router's dispatch (router.go) already calls
|
|
// r.ParseForm() before building params, and net/http's ParseForm merges
|
|
// URL query values and a url-encoded POST body into r.Form for any HTTP
|
|
// method — GET, POST, or otherwise — so every endpoint above already
|
|
// accepts either form for free.
|
|
//
|
|
// Precedence when the same key appears in both the query string and the
|
|
// POST body: net/http's ParseForm populates r.Form with POST-body values
|
|
// before query-string values, so params.Get (url.Values.Get, which
|
|
// returns the first entry) resolves a body value over a query value for
|
|
// the same key. This is deterministic — governed entirely by net/http's
|
|
// single parse of one request, not by any proxying/multi-parser
|
|
// ambiguity — and is asserted directly rather than silently relied upon;
|
|
// see TestFormPostBodyTakesPrecedenceOverQuery.
|
|
func init() {
|
|
registerExtension("formPost", 1)
|
|
}
|