-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix for Git request parameter problem (#771)
* update * fix: fix for Git request parameter problem
- Loading branch information
Showing
3 changed files
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,16 +20,19 @@ | |
import com.google.gson.JsonArray; | ||
import com.google.gson.JsonElement; | ||
import com.xiaomi.youpin.docean.mvc.httpmethod.HttpMethodUtils; | ||
import com.xiaomi.youpin.docean.mvc.util.GsonUtils; | ||
|
||
/** | ||
* @author [email protected] | ||
*/ | ||
public abstract class Post { | ||
|
||
private static Gson gson = new Gson(); | ||
|
||
public static JsonArray getParams(HttpRequestMethod method, byte[] data, MvcContext context) { | ||
JsonElement arguments = (null == data || data.length == 0) ? null : gson.fromJson(new String(data), JsonElement.class); | ||
JsonElement arguments = (null == data || data.length == 0) ? null : GsonUtils.gson.fromJson(new String(data), JsonElement.class); | ||
|
||
context.setParams(arguments); | ||
|
||
JsonArray array = new JsonArray(); | ||
HttpMethodUtils.addMvcContext(method, array); | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
jcommon/docean/src/main/java/com/xiaomi/youpin/docean/mvc/util/GsonUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.xiaomi.youpin.docean.mvc.util; | ||
|
||
import com.google.gson.Gson; | ||
|
||
/** | ||
* @author [email protected] | ||
* @date 2024/1/3 13:38 | ||
*/ | ||
public abstract class GsonUtils { | ||
|
||
public static Gson gson = new Gson(); | ||
|
||
} |