Also, add null check before adding HTTP prefix. This avoids null pointer exceptions and lets the UriBuilder deal with it
This commit is contained in:
parent
c085fc778d
commit
85d5477039
|
|
@ -58,7 +58,7 @@ Appsmith doesn't take the fun out of coding, because it treats every block as an
|
|||
* **5 minute setup**: Deploy Appsmith on your servers in 5 minutes.
|
||||
* **Build custom UI**: Drag & drop, resize and style widgets **without HTML / CSS**.
|
||||
* **Query data**: Query & update your database directly from the UI. Connect to **PostgreSQL, MongoDB, MySQL, REST & GraphQL APIs**.
|
||||
* **JS Logic**: Write snippets of business logic using JS to transform data, manipuate UI or trigger workflows. Use popular libraries like lodash & moment anywhere in the app
|
||||
* **JS Logic**: Write snippets of business logic using JS to transform data, manipulate UI or trigger workflows. Use popular libraries like lodash & moment anywhere in the app
|
||||
* **Data Workflows**: Simple configuration to create flows when users interact with the UI.
|
||||
* **Realtime Editor**: Changes in your application reflect instantly with every edit. No need to compile!
|
||||
* **Works with existing, live databases**: Connect directly to any PostgreSQL, MySQL & MongoDB
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ public class RapidApiPlugin extends BasePlugin {
|
|||
|
||||
URI uri;
|
||||
try {
|
||||
uri = createFinalUriWithQueryParams(url, actionConfiguration.getQueryParameters());
|
||||
String httpUrl = addHttpToUrlWhenPrefixNotPresent(url);
|
||||
uri = createFinalUriWithQueryParams(httpUrl, actionConfiguration.getQueryParameters());
|
||||
log.info("Final URL is : {}", uri);
|
||||
} catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
|
|
@ -287,6 +288,13 @@ public class RapidApiPlugin extends BasePlugin {
|
|||
}
|
||||
}
|
||||
|
||||
private String addHttpToUrlWhenPrefixNotPresent(String url) {
|
||||
if (url == null || url.toLowerCase().startsWith("http") || url.contains("://")) {
|
||||
return url;
|
||||
}
|
||||
return "http://" + url;
|
||||
}
|
||||
|
||||
private URI createFinalUriWithQueryParams(String url, List<Property> queryParams) throws URISyntaxException {
|
||||
UriComponentsBuilder uriBuilder = UriComponentsBuilder.newInstance();
|
||||
uriBuilder.uri(new URI(url));
|
||||
|
|
|
|||
|
|
@ -81,7 +81,8 @@ public class RestApiPlugin extends BasePlugin {
|
|||
HttpMethod httpMethod = actionConfiguration.getHttpMethod();
|
||||
URI uri;
|
||||
try {
|
||||
uri = createFinalUriWithQueryParams(url, actionConfiguration.getQueryParameters());
|
||||
String httpUrl = addHttpToUrlWhenPrefixNotPresent(url);
|
||||
uri = createFinalUriWithQueryParams(httpUrl, actionConfiguration.getQueryParameters());
|
||||
} catch (URISyntaxException e) {
|
||||
ActionExecutionRequest actionExecutionRequest = populateRequestFields(actionConfiguration, null);
|
||||
actionExecutionRequest.setUrl(url);
|
||||
|
|
@ -362,6 +363,13 @@ public class RestApiPlugin extends BasePlugin {
|
|||
return contentType;
|
||||
}
|
||||
|
||||
private String addHttpToUrlWhenPrefixNotPresent(String url) {
|
||||
if (url == null || url.toLowerCase().startsWith("http") || url.contains("://")) {
|
||||
return url;
|
||||
}
|
||||
return "http://" + url;
|
||||
}
|
||||
|
||||
private URI createFinalUriWithQueryParams(String url, List<Property> queryParams) throws URISyntaxException {
|
||||
UriComponentsBuilder uriBuilder = UriComponentsBuilder.newInstance();
|
||||
uriBuilder.uri(new URI(url));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user