package http

import 

// JoinPath returns an absolute URL path composed of the two paths provided.
// Enforces that the returned path begins with '/'. If added path is empty the
// returned path suffix will match the first parameter suffix.
func (,  string) string {
	if len() == 0 {
		 = "/"
	} else if [0] != '/' {
		 = "/" + 
	}

	if len() != 0 && [0] == '/' {
		 = [1:]
	}

	if len() != 0 && len() > 1 && [len()-1] != '/' {
		 =  + "/"
	}

	return  + 
}

// JoinRawQuery returns an absolute raw query expression. Any duplicate '&'
// will be collapsed to single separator between values.
func (,  string) string {
	 = strings.TrimFunc(, isAmpersand)
	 = strings.TrimFunc(, isAmpersand)

	if len() == 0 {
		return 
	}
	if len() == 0 {
		return 
	}

	return  + "&" + 
}

func ( rune) bool {
	return  == '&'
}