mirror of
				https://github.com/aykhans/dodo.git
				synced 2025-11-04 06:29:58 +00:00 
			
		
		
		
	Merge pull request #97 from aykhans/fix/nil-url
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				golangci-lint / lint (push) Successful in 58s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	golangci-lint / lint (push) Successful in 58s
				
			🐛 Fix nil URL referance
			
			
This commit is contained in:
		@@ -132,13 +132,14 @@ func (c *Config) Validate() []error {
 | 
				
			|||||||
	var errs []error
 | 
						var errs []error
 | 
				
			||||||
	if utils.IsNilOrZero(c.URL) {
 | 
						if utils.IsNilOrZero(c.URL) {
 | 
				
			||||||
		errs = append(errs, errors.New("request URL is required"))
 | 
							errs = append(errs, errors.New("request URL is required"))
 | 
				
			||||||
	}
 | 
						} else {
 | 
				
			||||||
		if c.URL.Scheme == "" {
 | 
							if c.URL.Scheme == "" {
 | 
				
			||||||
			c.URL.Scheme = "http"
 | 
								c.URL.Scheme = "http"
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if c.URL.Scheme != "http" && c.URL.Scheme != "https" {
 | 
							if c.URL.Scheme != "http" && c.URL.Scheme != "https" {
 | 
				
			||||||
			errs = append(errs, errors.New("request URL scheme must be http or https"))
 | 
								errs = append(errs, errors.New("request URL scheme must be http or https"))
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		urlParams := types.Params{}
 | 
							urlParams := types.Params{}
 | 
				
			||||||
		for key, values := range c.URL.Query() {
 | 
							for key, values := range c.URL.Query() {
 | 
				
			||||||
			for _, value := range values {
 | 
								for _, value := range values {
 | 
				
			||||||
@@ -150,6 +151,7 @@ func (c *Config) Validate() []error {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		c.Params = append(urlParams, c.Params...)
 | 
							c.Params = append(urlParams, c.Params...)
 | 
				
			||||||
		c.URL.RawQuery = ""
 | 
							c.URL.RawQuery = ""
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if utils.IsNilOrZero(c.Method) {
 | 
						if utils.IsNilOrZero(c.Method) {
 | 
				
			||||||
		errs = append(errs, errors.New("request method is required"))
 | 
							errs = append(errs, errors.New("request method is required"))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user