Skip to content

Releases: ant0ine/go-json-rest

v3.3.2

04 Dec 00:23
Compare
Choose a tag to compare

Version 3.3.2 Release Notes

What's New in v3.3.2 ?

  • Parse ipv6 addresses correctly (Thanks @mattsch)
  • Gzip middleware bug fix (Thanks @darvik80)
  • Fix microseconds Apache style logging
  • Fix recorder middleware to record status code only once (Thanks @mgkeen)
  • Fix CORS bug when Chrome send empty string CORS headers (Thanks @bboozzoo)

v3.3.1

19 Jan 00:07
Compare
Choose a tag to compare

Version 3.3.1 Release Notes

What's New in v3.3.1 ?

  • Refactor/add unit tests
  • Remove the ResourceHandler (v2 API) that was marked as deprecated a year ago.
  • Start using the simplifications (gofmt -s)
  • Minor documentation improvements

New third party Middlewares

Version 3.3.0 Release Notes

28 Nov 01:03
Compare
Choose a tag to compare

Version 3.3.0 Release Notes

What's New in v3.3.0 ?

  • Include charset=utf-8 in the JSON response Content-Type (See issue about Chrome)
  • Add the ability to customize the field name in the error response.
  • Additional HTTP methods shortcuts (Thanks @sebest !)
  • Add error is the parsed JSON payload is empty (Thanks @sebest !)

New third party Middlewares

v3.2.0

17 May 22:30
Compare
Choose a tag to compare

Version 3.2.0 Release Notes

What's New in v3.2.0 ?

  • New shortcut methods to create Routes more easily: Get(...), Post(...), Put(...), Delete(...). It also has the benefit to make golint happier. And &Route{...} remains available for any other use case.
  • New Websocket example. (Thanks @wingyplus !)
  • Security fix on the Jsonp Middleware. (Thanks @sebest !)
  • Documentation improvements

v3.1.0

30 Mar 08:11
Compare
Choose a tag to compare

Version 3.1.0 Release Notes

What's New in v3.1.0 ?

  • A new IfMiddleware that allows to conditionally execute a Middleware at runtime.
  • Better error messages when Env variables are missing (Timer, AccessLogApache, and Status Middlewares updated)
  • New Statsd example
  • New JWT authentication example
  • Improved code coverage

New Third party Middlewares

v3.0.0

03 Feb 07:33
Compare
Choose a tag to compare

Version 3 Release Notes

What's New in v3

  • Public Middlewares. (12 included in the package)
  • A new App interface. (the router being the provided App)
  • A new Api object that manages the Middlewares and the App.
  • Optional and interchangeable App/router.

Here is for instance the new minimal "Hello World!"

api := rest.NewApi()
api.Use(rest.DefaultDevStack...)
api.SetApp(rest.AppSimple(func(w rest.ResponseWriter, r *rest.Request) {
        w.WriteJson(map[string]string{"Body": "Hello World!"})
}))
http.ListenAndServe(":8080", api.MakeHandler())

All 19 examples have been updated to use the new API. See here

Deprecating the ResourceHandler

V3 is about deprecating the ResourceHandler in favor of a new API that exposes the Middlewares. As a consequence, all the Middlewares are now public, and the new Api object helps putting them together as a stack. Some default stack configurations are offered. The router is now an App that sits on top of the stack of Middlewares. Which means that the router is no longer required to use Go-Json-Rest.

Design ideas and discussion See here

Migration guide See here

v2.1.0

30 Nov 19:32
Compare
Choose a tag to compare

Main changes

  • Apache-style access log
  • Improved timer and recorder middlewares
  • new JSONP middleware
  • Make the gzip middleware support streaming responses

Apache-style access log

Go-Json-Rest now reuses the well known Apache log formatting syntax to define the access log.

With this new feature, the user can define his own record format:

rest.ResourceHandler{
        LoggerFormat: "%t %r %s %b",
}

or pick a predefined one:

rest.ResourceHandler{
        LoggerFormat: rest.CommonLogFormat,
}

or just just ignore this field and get a default, development friendly access log.

This is an implementation of a subset of the Apache mod_log_config syntax. Some options are not implemented yet, I expect the support can grow over time.
See http://httpd.apache.org/docs/2.0/mod/mod_log_config.html for reference.
And See Godoc for the list of supported options and predefined formats: https://godoc.org/github.com/ant0ine/go-json-rest/rest#AccessLogFormat

Note: Compatibility with the existing JSON logging is maintained. This JSON logging feature may be deprecated in the future is favor of a more powerful one. Internally, logMiddleware is replaced by accessLogApacheMiddleware and accessLogJsonMiddleware.

Improved timer and recorder middlewares

  • timerMiddleware now populates request.Env["START_TIME"]
  • recorderMiddleware now records request.Env["BYTES_WRITTEN"]
  • tests have been added to both

JSONP middleware

This is a new public middleware that can be instantiated like this:

    handler := rest.ResourceHandler{
        PreRoutingMiddlewares: []rest.Middleware{
            &rest.JsonpMiddleware{
                CallbackNameKey: "cb",
            },
        },
    }

See the complete example here: https://github.com/ant0ine/go-json-rest#jsonp

Make the gzip middleware support streaming responses

The gzip Writer is now instantiated once per response, allowing multiple calls to response.Write() or response.WriteJson().
See the streaming example here: https://github.com/ant0ine/go-json-rest#streaming

v2.0.6

28 Oct 05:58
Compare
Choose a tag to compare
  • Deprecate RouteObjectMethod in favor of Method Values
  • New option to fully disable the access log middleware
  • support http.Hijacker
  • performance improvements

v2.0.5

04 Aug 01:14
Compare
Choose a tag to compare
  • New OuterMiddlewares for custom logging and reporting.
  • statsd example
  • api-versioning example
  • public WrapMiddlewares method.

v2.0.4

13 Jul 22:32
Compare
Choose a tag to compare
  • New "relaxed" placeholder type (notation #paramName) that matches all chars until the first /
  • Improved and new examples
  • Performance improvements
  • Documentation improvements