2021-01-17 21:46:25 +08:00
|
|
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
2018-12-10 20:24:20 +08:00
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
|
|
// If a copy of the MIT was not distributed with this file,
|
2019-02-02 16:18:25 +08:00
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
2018-12-10 20:24:20 +08:00
|
|
|
|
|
|
|
package ghttp
|
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// SetRewrite sets rewrites for static URI for server.
|
2018-12-10 20:24:20 +08:00
|
|
|
func (s *Server) SetRewrite(uri string, rewrite string) {
|
2019-06-19 09:06:52 +08:00
|
|
|
s.config.Rewrites[uri] = rewrite
|
2018-12-10 20:24:20 +08:00
|
|
|
}
|
|
|
|
|
2022-03-19 17:58:21 +08:00
|
|
|
// SetRewriteMap sets the rewritten map for server.
|
2018-12-10 20:24:20 +08:00
|
|
|
func (s *Server) SetRewriteMap(rewrites map[string]string) {
|
2019-06-19 09:06:52 +08:00
|
|
|
for k, v := range rewrites {
|
|
|
|
s.config.Rewrites[k] = v
|
|
|
|
}
|
|
|
|
}
|
2019-12-18 19:37:07 +08:00
|
|
|
|
2020-05-01 03:31:04 +08:00
|
|
|
// SetRouteOverWrite sets the RouteOverWrite for server.
|
2019-12-18 19:37:07 +08:00
|
|
|
func (s *Server) SetRouteOverWrite(enabled bool) {
|
|
|
|
s.config.RouteOverWrite = enabled
|
|
|
|
}
|