Releases: xgfone/ship
Releases · xgfone/ship
v3.10.0
- Changed:
Ship.AddRoute()
always returnsRouteError
when an error occurs.Context.Execute()
requires thatRouter.Find()
must returnnil
orRouteInfo
as the handler, no longer to supportHandler
.
- Fixed:
Context.FindRoute()
updates the fieldRouteInfo
when finding the route.
- Others:
- Optimize the match of the host router.
v3.9.0
- Added:
Runner
logs the listening address when starting and shutdowning the server.- Add the method
FindRoute
forContext
to find the route by the request method and path. - Add the field
RouteInfo
forContext
to acquire the information of the registered route associated with the handler.
- Changed:
- Use
RouteInfo
as the handler context to register intoRouter
. - Allow
NewLoggerFromStdlog
to supportnil
to discard the logs. - Allow the method
Find
ofRouter
to ignore the path paramethers whenpnames
orpvalues
is empty.
- Use
v3.8.0
- Added:
- The middleware
Logger
supports to log the request body. - The function
SetStructFieldToDefault()
supports the new typesstruct
and[]struct
. - Add the function
RequestJSONWithContextAndHeaders
to supports the customized request headers.
- The middleware
- Changed:
Context.Bind()
binds the request arguments before setting the default.
- Deprecated:
- The middleware
ReqBodyLogger
is deprecated.
- The middleware
v3.7.0
v3.6.0
- Added:
- The methods
GetHeader
,QueryParam
,FormValue
ofContext
supports the default value. - Add the new methods
New
andNewf
for the error typeHTTPError
.
- The methods
- Deprecate:
- Deprecate the field
Msg
and the methodsGetMsg
,GetError
,NewError
andNewMsg
of the error typeHTTPError
.
- Deprecate the field
v3.5.0
- Added:
- Add the HTTP client error
HTTPClientError
. - Add the alias
HTTPServerError
ofHTTPError
. - Add the alias
NewHTTPServerError
ofNewHTTPError
. - Add some convenient HTTP client functions like
RequestJSONWithContext
,GetJSON
,PostJSON
, etc. - Add the compatible
NewRequestWithContext
ofhttp.NewRequestWithContext
to be compatible with go below 1.13.
- Add the HTTP client error
v3.4.0
- Added:
- Add the middleware
ReqBodyLogger
to log the request body. - Add the method
ResetMiddlewares
andResetPreMiddlewares
forShip
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 interfaceSetDefault
to customize the setter of the default value.
- Add the middleware
- Changed:
- Move the setter of the default value before binding when binding a value from the request.
v3.3.0
v3.2.0
Added:
- Add the context data to the route, and get it from
RouteCtxData
ofContext
in the handler. Context
supportsValidator
to validate whether the bind value is valid when callingBind()
andBindQuery()
.Context
supports default setter to set the default value for the zero bind value when callingBind()
andBindQuery()
, and add a default implementation only forstruct
.
Changed:BindURLValues
ignores the field when tag value is"-"
.
v3.1.0
- Added:
- Add the method
RouteInfo
forRoute
to convert itself toRouteInfo
. - 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.
- Add the method
- Changed:
Router#Add
supports the ANY method when method is empty.