From 3fcc4e296f717214ca7bb6792864d02f835914b7 Mon Sep 17 00:00:00 2001 From: Frank Mueller Date: Thu, 9 Nov 2017 16:55:47 +0100 Subject: [PATCH] Added status codes and mode doc renaming --- CHANGELOG.md | 17 +++++++++++------ README.md | 12 ++++++------ handlers/audit.go | 2 +- handlers/doc.go | 6 +++--- handlers/errors.go | 2 +- handlers/fileserve.go | 2 +- handlers/fileupload.go | 2 +- handlers/handlers_test.go | 2 +- handlers/jwtauth.go | 2 +- handlers/wrapper.go | 2 +- jwt/algorithm.go | 2 +- jwt/cache.go | 2 +- jwt/cache_test.go | 2 +- jwt/claims.go | 2 +- jwt/claims_test.go | 2 +- jwt/doc.go | 4 ++-- jwt/errors.go | 2 +- jwt/header.go | 2 +- jwt/header_test.go | 2 +- jwt/jwt.go | 2 +- jwt/jwt_test.go | 2 +- jwt/key.go | 2 +- request/doc.go | 7 +++---- request/errors.go | 2 +- request/request.go | 2 +- request/request_test.go | 2 +- rest/context.go | 2 +- rest/doc.go | 6 +++--- rest/environment.go | 2 +- rest/errors.go | 2 +- rest/formatter.go | 9 ++++++++- rest/handler.go | 2 +- rest/job.go | 2 +- rest/mapping.go | 2 +- rest/multiplexer.go | 2 +- rest/path.go | 2 +- rest/rest_test.go | 2 +- rest/templates.go | 2 +- rest/tools.go | 2 +- restaudit/doc.go | 12 ++++++------ restaudit/restaudit.go | 2 +- 41 files changed, 75 insertions(+), 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c67e46..9063bff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,27 @@ -# Tideland Go REST Server Library +# Tideland GoREST -## 2017-10-25 +## Version 2.15.5 (2017-11-09) + +- Added needed status codes +- Renamings in docs and comments due to new project name + +## Version 2.15.4 (2017-10-25) - Function `jwt.AddTokenToRequest()` is deprecated, now it is `AddToRequest()`; sadly forgot backward compatability, so now are both available but first with an according comment -## 2017-09-10 +## Version 2.15.3 (2017-09-10) - Fixed return code in case of not implemented HTTP methods to `405` (method not allowed) -## 2017-06-19 +## Version 2.15.2 (2017-06-19) - Reduced job handling complexity -## 2017-05-15 +## Version 2.15.1 (2017-05-15) - Changed `Job.Path()` to return a `Path` instance - This instance provides access to the different parts @@ -26,7 +31,7 @@ `ResourceID()`) while the method `ResourceID()` of path returns only the third part of the path -## 2017-04-26 +## Version 2.15.0 (2017-04-26) - Added access to URL path parts via `Job.Path()` - Added interfaces for handler methods directly mapping diff --git a/README.md b/README.md index 2999955..e6c495d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# Tideland Go REST Server Library +# Tideland GoREST ## Description -The *Tideland Go REST Server Library* helps developing RESTful server -systems. It provides a convenient mapping of URL to handlers and methods -specific to the called HTTP method. Additionally there are helpers for -marshalling and unmarshalling. +*Tideland GoREST* helps developing RESTful server systems. It +provides a convenient mapping of URL to handlers and methods +specific to the called HTTP method. Additionally there are helpers +for marshalling and unmarshalling. The library earlier has been known as `web` package of the [Tideland Go Library](https://github.com/tideland/golib). @@ -20,7 +20,7 @@ I hope you like it. ;) ## Version -Version 2.15.4 +Version 2.15.5 ## Packages diff --git a/handlers/audit.go b/handlers/audit.go index 2ab2a04..793c078 100644 --- a/handlers/audit.go +++ b/handlers/audit.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Handlers - Audit Handler +// Tideland GoREST - Handlers - Audit Handler // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/handlers/doc.go b/handlers/doc.go index 37ec7af..566985f 100644 --- a/handlers/doc.go +++ b/handlers/doc.go @@ -1,12 +1,12 @@ -// Tideland Go REST Server Library - Handlers +// Tideland GoREST - Handlers // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // // All rights reserved. Use of this source code is governed // by the new BSD license. -// Package handlers of the Tideland Go REST Server Library implements -// some initial resource handlers to integrate into own solutions. +// Package handlers of Tideland GoREST implements some initial +// resource handlers to integrate into own solutions. package handlers // EOF diff --git a/handlers/errors.go b/handlers/errors.go index bf09114..02b9b9f 100644 --- a/handlers/errors.go +++ b/handlers/errors.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Handlers - Errors +// Tideland GoREST - Handlers - Errors // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/handlers/fileserve.go b/handlers/fileserve.go index 92b6530..9357d12 100644 --- a/handlers/fileserve.go +++ b/handlers/fileserve.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Handlers - File Serve +// Tideland GoREST - Handlers - File Serve // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/handlers/fileupload.go b/handlers/fileupload.go index 195f5b7..ba923a9 100644 --- a/handlers/fileupload.go +++ b/handlers/fileupload.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Handlers - File Upload +// Tideland GoREST - Handlers - File Upload // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/handlers/handlers_test.go b/handlers/handlers_test.go index b9e9527..b09baef 100644 --- a/handlers/handlers_test.go +++ b/handlers/handlers_test.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Handlers - Unit Tests +// Tideland GoREST - Handlers - Unit Tests // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/handlers/jwtauth.go b/handlers/jwtauth.go index ba22855..fa104c7 100644 --- a/handlers/jwtauth.go +++ b/handlers/jwtauth.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Handlers - JWT Authorization +// Tideland GoREST - Handlers - JWT Authorization // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/handlers/wrapper.go b/handlers/wrapper.go index 2336520..73907e6 100644 --- a/handlers/wrapper.go +++ b/handlers/wrapper.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Handlers - Wrapper +// Tideland GoREST - Handlers - Wrapper // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/algorithm.go b/jwt/algorithm.go index abb42fe..0aa7abd 100644 --- a/jwt/algorithm.go +++ b/jwt/algorithm.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Algorithm +// Tideland GoREST - JSON Web Token - Algorithm // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/cache.go b/jwt/cache.go index afade47..c450f8e 100644 --- a/jwt/cache.go +++ b/jwt/cache.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Cache +// Tideland GoREST - JSON Web Token - Cache // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/cache_test.go b/jwt/cache_test.go index 35fdea1..5d87ced 100644 --- a/jwt/cache_test.go +++ b/jwt/cache_test.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Unit Tests +// Tideland GoREST - JSON Web Token - Unit Tests // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/claims.go b/jwt/claims.go index c0af70a..c091e0a 100644 --- a/jwt/claims.go +++ b/jwt/claims.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Claims +// Tideland GoREST - JSON Web Token - Claims // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/claims_test.go b/jwt/claims_test.go index e0ed5ab..c7d5c45 100644 --- a/jwt/claims_test.go +++ b/jwt/claims_test.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Unit Tests +// Tideland GoREST - JSON Web Token - Unit Tests // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/doc.go b/jwt/doc.go index 4ee79e8..1f4e7b6 100644 --- a/jwt/doc.go +++ b/jwt/doc.go @@ -1,11 +1,11 @@ -// Tideland Go REST Server Library - JSON Web Token +// Tideland GoREST - JSON Web Token // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // // All rights reserved. Use of this source code is governed // by the new BSD license. -// Package jwt of the Tideland Go REST Server Library provides the generation, +// Package jwt of Tideland GoREST provides the generation, // verification, and analyzing of JSON Web Tokens. package jwt diff --git a/jwt/errors.go b/jwt/errors.go index 862f4da..0a7b620 100644 --- a/jwt/errors.go +++ b/jwt/errors.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Errors +// Tideland GoREST - JSON Web Token - Errors // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/header.go b/jwt/header.go index bfc9345..799ff17 100644 --- a/jwt/header.go +++ b/jwt/header.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Header +// Tideland GoREST - JSON Web Token - Header // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/header_test.go b/jwt/header_test.go index fd3986f..393dcc7 100644 --- a/jwt/header_test.go +++ b/jwt/header_test.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Unit Tests +// Tideland GoREST - JSON Web Token - Unit Tests // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/jwt.go b/jwt/jwt.go index 4d8401f..c642bc0 100644 --- a/jwt/jwt.go +++ b/jwt/jwt.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token +// Tideland GoREST - JSON Web Token // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/jwt_test.go b/jwt/jwt_test.go index 0eb78ee..2cb0e51 100644 --- a/jwt/jwt_test.go +++ b/jwt/jwt_test.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Unit Tests +// Tideland GoREST - JSON Web Token - Unit Tests // // Copyright (C) 2016 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/jwt/key.go b/jwt/key.go index 90dab28..8e4ca78 100644 --- a/jwt/key.go +++ b/jwt/key.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - JSON Web Token - Keys +// Tideland GoREST - JSON Web Token - Keys // // Copyright (C) 2016-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/request/doc.go b/request/doc.go index b814174..b714b23 100644 --- a/request/doc.go +++ b/request/doc.go @@ -1,13 +1,12 @@ -// Tideland Go REST Server Library - Request +// Tideland GoREST - Request // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // // All rights reserved. Use of this source code is governed // by the new BSD license. -// Package request of the Tideland Go REST Server Library provides -// a simple way to handle cross-server requests in the Tideland -// REST ecosystem. +// Package request of Tideland GoREST provides a simple way to +// handle cross-server requests in the Tideland REST ecosystem. package request //-------------------- diff --git a/request/errors.go b/request/errors.go index 7b85e6a..56ba87e 100644 --- a/request/errors.go +++ b/request/errors.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Request - Errors +// Tideland GoREST - Request - Errors // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/request/request.go b/request/request.go index c3c2477..8da2f32 100644 --- a/request/request.go +++ b/request/request.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Request +// Tideland GoREST - Request // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/request/request_test.go b/request/request_test.go index da782b3..d629bcc 100644 --- a/request/request_test.go +++ b/request/request_test.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - Request - Unit Tests +// Tideland GoREST - Request - Unit Tests // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/context.go b/rest/context.go index 78de7a7..73c0201 100644 --- a/rest/context.go +++ b/rest/context.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Context +// Tideland GoREST - REST - Context // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/doc.go b/rest/doc.go index 9f8af58..ccba890 100644 --- a/rest/doc.go +++ b/rest/doc.go @@ -1,12 +1,12 @@ -// Tideland Go REST Server Library - REST +// Tideland GoREST - REST // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // // All rights reserved. Use of this source code is governed // by the new BSD license. -// Package rest of the Tideland Go REST Server Library provides types for -// the implementation of servers with a RESTful API. The business has to +// Package rest of Tideland GoREST provides types for the +// implementation of servers with a RESTful API. The business has to // be implemented in types fullfilling the ResourceHandler interface. // This basic interface only allows the initialization of the handler. // More interesting are the other interfaces like GetResourceHandler diff --git a/rest/environment.go b/rest/environment.go index 37c514d..8e3481b 100644 --- a/rest/environment.go +++ b/rest/environment.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Environment +// Tideland GoREST - REST - Environment // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/errors.go b/rest/errors.go index 6525b5f..ebaf9b8 100644 --- a/rest/errors.go +++ b/rest/errors.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Errors +// Tideland GoREST - REST - Errors // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/formatter.go b/rest/formatter.go index b0e2a1f..c11ad0c 100644 --- a/rest/formatter.go +++ b/rest/formatter.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Formatter +// Tideland GoREST - REST - Formatter // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // @@ -40,6 +40,13 @@ const ( StatusUnauthorized = http.StatusUnauthorized StatusForbidden = http.StatusForbidden StatusNotFound = http.StatusNotFound + StatusMethodNotAllowed = http.StatusMethodNotAllowed + StatusNotAcceptable = http.StatusNotAcceptable + StatusGone = http.StatusGone + StatusPreconditionFailed = http.StatusPreconditionFailed + StatusUnprocessableEntity = http.StatusUnprocessableEntity + StatusLocked = http.StatusLocked + StatusTooManyRequests = http.StatusTooManyRequests StatusConflict = http.StatusConflict StatusInternalServerError = http.StatusInternalServerError ) diff --git a/rest/handler.go b/rest/handler.go index b4773d5..5f51c82 100644 --- a/rest/handler.go +++ b/rest/handler.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Handlers +// Tideland GoREST - REST - Handlers // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/job.go b/rest/job.go index 73e2a10..0be7269 100644 --- a/rest/job.go +++ b/rest/job.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Job +// Tideland GoREST - REST - Job // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/mapping.go b/rest/mapping.go index 4e1f43c..365821b 100644 --- a/rest/mapping.go +++ b/rest/mapping.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Mapping +// Tideland GoREST - REST - Mapping // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/multiplexer.go b/rest/multiplexer.go index 4a507ce..4c49ac8 100644 --- a/rest/multiplexer.go +++ b/rest/multiplexer.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Multiplexer +// Tideland GoREST - REST - Multiplexer // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/path.go b/rest/path.go index 5cadbd5..0c7c004 100644 --- a/rest/path.go +++ b/rest/path.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Path +// Tideland GoREST - REST - Path // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/rest_test.go b/rest/rest_test.go index 66e9528..1dfce67 100644 --- a/rest/rest_test.go +++ b/rest/rest_test.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Unit Tests +// Tideland GoREST - REST - Unit Tests // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/templates.go b/rest/templates.go index 3013674..edb7a23 100644 --- a/rest/templates.go +++ b/rest/templates.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - templatesCache +// Tideland GoREST - REST - Templates // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/rest/tools.go b/rest/tools.go index 86345d7..499e337 100644 --- a/rest/tools.go +++ b/rest/tools.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST - Tools +// Tideland GoREST - REST - Tools // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // diff --git a/restaudit/doc.go b/restaudit/doc.go index fd22a84..d60bd6f 100644 --- a/restaudit/doc.go +++ b/restaudit/doc.go @@ -1,15 +1,15 @@ -// Tideland Go REST Server Library - REST Audit +// Tideland GoREST - REST Audit // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany // // All rights reserved. Use of this source code is governed // by the new BSD license. -// Package restaudit of the Tideland Go REST Server Library is a little -// helper package for the unit testing of the rest package and the -// resource handlers. Requests can easily be created, marshalling data -// based on the content-type is done automatically. Response also -// provides assert methods for the tests. +// Package restaudit of Tideland GoREST is a little helper package +// for the unit testing of the rest package and the resource handlers. +// Requests can easily be created, marshalling data based on the +// content-type is done automatically. Response also provides assert +// methods for the tests. // // So first step is to create a test server and register the handler(s) // to test. Could best be done with a little helper function, depending diff --git a/restaudit/restaudit.go b/restaudit/restaudit.go index 1783a5a..9e37085 100644 --- a/restaudit/restaudit.go +++ b/restaudit/restaudit.go @@ -1,4 +1,4 @@ -// Tideland Go REST Server Library - REST Audit +// Tideland GoREST - REST Audit // // Copyright (C) 2009-2017 Frank Mueller / Tideland / Oldenburg / Germany //