Package io.github.parthappm.http.client
Class SimpleClient
java.lang.Object
io.github.parthappm.http.client.SimpleClient
A class that contains all static methods to create an object of Client class by parsing the provided URL. The methods in this class does not make the request, to make the request, request() method of the returned object needs to be called.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Client
Builds a get request from the provided URL, but does not make the request.static Client
Builds a post request from the provided URL and request body, but does not make the request.static Client
Builds an HTTP request for the mentioned HTTP method from the provided URL, but does not make the request.
-
Method Details
-
get
Builds a get request from the provided URL, but does not make the request.- Parameters:
url
- The URL to which the request is made- Returns:
- An object of Client class
- Throws:
MalformedURLException
- if the URL passed is not a valid URL
-
post
Builds a post request from the provided URL and request body, but does not make the request.- Parameters:
url
- The URL to which the request is madebody
- The data to be sent as request body- Returns:
- An object of Client class
- Throws:
MalformedURLException
- if the URL passed is not a valid URL
-
request
Builds an HTTP request for the mentioned HTTP method from the provided URL, but does not make the request.- Parameters:
method
- The HTTP method to be used or the type of request i.e. GET, POST, PUT, DELETE, etc.url
- The URL to which the request is made- Returns:
- An object of Client class
- Throws:
MalformedURLException
- if the URL passed is not a valid URL
-