mirror of
				https://github.com/TeaOSLab/EdgeAPI.git
				synced 2025-11-04 07:50:25 +08:00 
			
		
		
		
	REST 接口接收内容为空时,默认为 {}
This commit is contained in:
		@@ -170,6 +170,11 @@ func (this *RestServer) handle(writer http.ResponseWriter, req *http.Request) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 如果为空,表示传的数据为空
 | 
			
		||||
	if len(body) == 0 {
 | 
			
		||||
		body = []byte("{}")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 请求数据
 | 
			
		||||
	var reqValue = reflect.New(method.Type().In(1).Elem()).Interface()
 | 
			
		||||
	err = json.Unmarshal(body, reqValue)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user