initial commits
							parent
							
								
									9c0263cfa4
								
							
						
					
					
						commit
						1012adefc9
					
				| 
						 | 
				
			
			@ -0,0 +1,32 @@
 | 
			
		|||
package maymoon
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"sourcecode.social/reiver/go-errhttp"
 | 
			
		||||
 | 
			
		||||
	"errors"
 | 
			
		||||
	"net/http"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func requestPath(request *http.Request) (string, error) {
 | 
			
		||||
	if nil == request {
 | 
			
		||||
/////////////// RETURN
 | 
			
		||||
		return "", errhttp.InternalServerErrorWrap(errors.New("Missing Request"))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var requestpath string
 | 
			
		||||
	{
 | 
			
		||||
		uri := request.URL
 | 
			
		||||
		if nil == uri {
 | 
			
		||||
/////////////////////// RETURN
 | 
			
		||||
			return "", errhttp.InternalServerErrorWrap(errors.New("Missing Internal Request-URI"))
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		requestpath = uri.Path
 | 
			
		||||
		if "" == requestpath {
 | 
			
		||||
/////////////////////// RETURN
 | 
			
		||||
			return "", errhttp.BadRequestWrap(errors.New("Bad Path In Request-URI"))
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return requestpath, nil
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
		Reference in New Issue