Skip to content

Commit

Permalink
[serving] Treat empty HTTP parameter as absent (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Jan 18, 2023
1 parent d86b22e commit 5507d89
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion serving/src/main/java/ai/djl/serving/util/NettyUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,11 @@ public static byte[] getBytes(ByteBuf buf) {
public static String getParameter(QueryStringDecoder decoder, String key, String def) {
List<String> param = decoder.parameters().get(key);
if (param != null && !param.isEmpty()) {
return param.get(0);
String ret = param.get(0);
if (ret.isEmpty()) {
return def;
}
return ret;
}
return def;
}
Expand Down

0 comments on commit 5507d89

Please sign in to comment.