1.2.0 • Published 5 years ago

endpointlocation v1.2.0

Weekly downloads
2
License
GPL-3.0
Repository
github
Last release
5 years ago

EndpointLocation

A URL manipulation utility similar to the familiar Location interface (in window). The main difference is that Location's API 1 only accepts a URL string (and another Location object via toString()), but EndpointLocation's API allows all that plus "construction by configuration" and empty construction for convenience.

let clientEndpoint = new EndpointLocation(
{
	'hostname':'example.com',
	'pathname':'/'.concat( ['path', 'to', 'endpoint'].join( '/' )),
	'params':{'hash':'of', 'url':'parameters'},
	'protocol':'https:',
});
request.get(
	{
		'headers':
		{
			'Accept':'application/json',
			'User-Agent':'request',
		},
		// The convenience of `EndpointLocation`.
		'url':clientEndpoint.href,
		// "https://example.com/path/to/endpoint?hash=of&url=parameters"
	},
	function response_handler( error, httpResponse, responseText )
	{}
);

1. https://www.w3.org/TR/html50/browsers.html#the-location-interface

1.2.0

5 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago