Skip to content

Commit

Permalink
fix: fix for Git request parameter problem (#771)
Browse files Browse the repository at this point in the history
* update

* fix: fix for Git request parameter problem
  • Loading branch information
goodjava authored Jan 3, 2024
1 parent eb07104 commit e485908
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.xiaomi.youpin.docean.anno.RequestParam;
import com.xiaomi.youpin.docean.mvc.httpmethod.HttpMethodUtils;
import io.netty.handler.codec.http.QueryStringDecoder;

import java.lang.annotation.Annotation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
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();

}

0 comments on commit e485908

Please sign in to comment.