Browse Source

fix:上传文件用PUT;修改一个接口地址

master
Morning.Chen 2 years ago
parent
commit
29a1c31093
  1. 2
      src/main/java/com/fanruan/hihidata/datasource/server/DatasourceOperation.java
  2. 2
      src/main/java/com/fanruan/hihidata/datasource/server/http/HttpKits.java

2
src/main/java/com/fanruan/hihidata/datasource/server/DatasourceOperation.java

@ -59,7 +59,7 @@ public class DatasourceOperation {
JSONObject body = new JSONObject(); JSONObject body = new JSONObject();
body.put("tableId", tableId); body.put("tableId", tableId);
HttpEntity entity = new StringEntity(body.toString(), StandardCharsets.UTF_8); HttpEntity entity = new StringEntity(body.toString(), StandardCharsets.UTF_8);
String res = HttpKits.post(String.format("%s/api/v1/datasource/table/upload/url", ProjectConstants.BASE_URI), headers(), entity); String res = HttpKits.post(String.format("%s/api/v1/datasource/upload/url", ProjectConstants.BASE_URI), headers(), entity);
JSONObject data = new JSONObject(res); JSONObject data = new JSONObject(res);
return data.getString("data"); return data.getString("data");
} }

2
src/main/java/com/fanruan/hihidata/datasource/server/http/HttpKits.java

@ -254,7 +254,7 @@ public class HttpKits {
* @throws IOException 上传中出现错误则抛出此异常 * @throws IOException 上传中出现错误则抛出此异常
*/ */
public static void upload(String url, FileEntity fileEntity, Charset charset) throws IOException { public static void upload(String url, FileEntity fileEntity, Charset charset) throws IOException {
upload(url, fileEntity, charset, Collections.emptyMap(), HttpRequestType.POST); upload(url, fileEntity, charset, Collections.emptyMap(), HttpRequestType.PUT);
} }
/** /**

Loading…
Cancel
Save