Skip to content

linkosmos/urlutils

Repository files navigation

urlutils

Build Status Coverage Status GoDoc Go Report Card MIT License

Golang standard URL wrapper, adds syntactic sugar and few new methods.

  • ResolveURL: resolves relative URL to absolute URL
  • IsAsset: matches asset URL's like: .css, .js, etc.
  • IsRelative: checks whether URL is relative, e.g.: /news/article/13.html
  • IsAbsolute: checks whether URL has absolute (full) path
  • SameDomain: compares URL's checks if they have same domain
  • AddWWW: prepends www in front of Host
  • AddHTTP: adds http:// if Scheme is empty
  • NormalizeDomain: strips sub-domains from Host
  • StripParams: strips path, query & fragment from URL
  • ReverseDomain: reverses URL Host, e.g.: www.example.com => com.example.www
  • SplitPath: splits URL structure Path into desired leveled segments
  • NormalizeURL: cleans params, adds www, insecures http scheme
  • HostTLD: resolves url host top level domain
  • IsHomePage: top level root URL
  • IsEmptyQuery: whether URL query and fragment is empty or not
  • IsEmptyPath: whether URL doesn't have /path
  • IsPlain: whether URL has no query and path
  • IsNotPlain: reverse of IsPlain

About

urlutils - Go standard url wrapper, adds new methods & some syntactic sugar methods

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published