first push
This commit is contained in:
		
							parent
							
								
									d437bfae2b
								
							
						
					
					
						commit
						8fe8d3f716
					
				
							
								
								
									
										13
									
								
								request.go
								
								
								
								
							
							
						
						
									
										13
									
								
								request.go
								
								
								
								
							|  | @ -69,14 +69,21 @@ func (r *Request) getData() io.Reader { | ||||||
| 			urlValues.Add(key, value) | 			urlValues.Add(key, value) | ||||||
| 		} | 		} | ||||||
| 		reqBody = urlValues.Encode() | 		reqBody = urlValues.Encode() | ||||||
| 		r.Headers["Content-Type"] = "application/x-www-form-urlencoded" | 		if _, ex := r.Headers["Content-Type"]; !ex { | ||||||
|  | 			r.Headers["Content-Type"] = "application/x-www-form-urlencoded" | ||||||
|  | 		} | ||||||
|  | 
 | ||||||
| 	} else if r.Json != nil { | 	} else if r.Json != nil { | ||||||
| 		bytesData, _ := json.Marshal(r.Json) | 		bytesData, _ := json.Marshal(r.Json) | ||||||
| 		reqBody = string(bytesData) | 		reqBody = string(bytesData) | ||||||
| 		r.Headers["Content-Type"] = "application/json" | 		if _, ex := r.Headers["Content-Type"]; !ex { | ||||||
|  | 			r.Headers["Content-Type"] = "application/json" | ||||||
|  | 		} | ||||||
| 	} else if r.JsonByte != nil { | 	} else if r.JsonByte != nil { | ||||||
| 		reqBody = string(r.JsonByte) | 		reqBody = string(r.JsonByte) | ||||||
| 		r.Headers["Content-Type"] = "application/json" | 		if _, ex := r.Headers["Content-Type"]; !ex { | ||||||
|  | 			r.Headers["Content-Type"] = "application/json" | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
| 	return strings.NewReader(reqBody) | 	return strings.NewReader(reqBody) | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue