Skip to content

Releases: xgfone/ship

v3.10.0

22 Feb 13:33
Compare
Choose a tag to compare
  • Changed:
    • Ship.AddRoute() always returns RouteError when an error occurs.
    • Context.Execute() requires that Router.Find() must return nil or RouteInfo as the handler, no longer to support Handler.
  • Fixed:
    • Context.FindRoute() updates the field RouteInfo when finding the route.
  • Others:
    • Optimize the match of the host router.

v3.9.0

13 Jan 14:55
Compare
Choose a tag to compare
  • Added:
    • Runner logs the listening address when starting and shutdowning the server.
    • Add the method FindRoute for Context to find the route by the request method and path.
    • Add the field RouteInfo for Context to acquire the information of the registered route associated with the handler.
  • Changed:
    • Use RouteInfo as the handler context to register into Router.
    • Allow NewLoggerFromStdlog to support nil to discard the logs.
    • Allow the method Find of Router to ignore the path paramethers when pnames or pvalues is empty.

v3.8.0

01 Jan 09:46
Compare
Choose a tag to compare
  • Added:
    • The middleware Logger supports to log the request body.
    • The function SetStructFieldToDefault() supports the new types struct and []struct.
    • Add the function RequestJSONWithContextAndHeaders to supports the customized request headers.
  • Changed:
    • Context.Bind() binds the request arguments before setting the default.
  • Deprecated:
    • The middleware ReqBodyLogger is deprecated.

v3.7.0

17 Oct 05:29
Compare
Choose a tag to compare
  • Added:
    • Add the new methods HasHeader, HasQuery for Context.
  • Changed:
    • RequestJSONWithContext supports to fix the http.Request and use the returned http.Request.
  • Fixed:
    • Fix some bugs.

v3.6.0

17 Sep 15:28
Compare
Choose a tag to compare
  • Added:
    • The methods GetHeader, QueryParam, FormValue of Context supports the default value.
    • Add the new methods New and Newf for the error type HTTPError.
  • Deprecate:
    • Deprecate the field Msg and the methods GetMsg, GetError, NewError and NewMsg of the error type HTTPError.

v3.5.0

04 Sep 13:02
Compare
Choose a tag to compare
  • Added:
    • Add the HTTP client error HTTPClientError.
    • Add the alias HTTPServerError of HTTPError.
    • Add the alias NewHTTPServerError of NewHTTPError.
    • Add some convenient HTTP client functions like RequestJSONWithContext, GetJSON, PostJSON, etc.
    • Add the compatible NewRequestWithContext of http.NewRequestWithContext to be compatible with go below 1.13.

v3.4.0

21 Aug 15:31
Compare
Choose a tag to compare
  • Added:
    • Add the middleware ReqBodyLogger to log the request body.
    • Add the method ResetMiddlewares and ResetPreMiddlewares for Ship to reset the middlewares.
    • The echo router supports removing the trailing slash of the path when registering or finding the route handler.
    • The function SetStructFieldToDefault supports the interface SetDefault to customize the setter of the default value.
  • Changed:
    • Move the setter of the default value before binding when binding a value from the request.

v3.3.0

10 Aug 13:57
Compare
Choose a tag to compare
  • Added:
    • Add the method HTTPHandler() for Handler to convert itself to http.Handler.
  • Changed:
    • ToHTTPHandler allows the first argument s *Ship to be nil.
    • Runner.Start() enables TLS when either Certificates or GetCertificate of Runner.Server is not empty.

v3.2.0

01 Aug 14:09
Compare
Choose a tag to compare

Added:

  • Add the context data to the route, and get it from RouteCtxData of Context in the handler.
  • Context supports Validator to validate whether the bind value is valid when calling Bind() and BindQuery().
  • Context supports default setter to set the default value for the zero bind value when calling Bind() and BindQuery(), and add a default implementation only for struct.
    Changed:
  • BindURLValues ignores the field when tag value is "-".

v3.1.0

15 Jul 15:17
Compare
Choose a tag to compare
  • Added:
    • Add the method RouteInfo for Route to convert itself to RouteInfo.
    • Add the support of the prefix/suffix and regexp match for the virtual host.
    • Add the general router implementation, the performance of which falls off 10%, compared to the echo router implementation.
  • Changed:
    • Router#Add supports the ANY method when method is empty.