Minor improvements#7
Conversation
ecolabardini
commented
Apr 15, 2018
- Separate XML and JSON body resolvers so anyone can write new ones just by extending the VariableResolver interface
- Resolve variables per conditional instead of pre-processing all of them first
| public static String extractValueFromJson(String name, HttpServletRequest request) { | ||
| @Override | ||
| public boolean handles(String variable) { | ||
| return variable.startsWith("body."); |
There was a problem hiding this comment.
Faria sentido verificar se é JSON para retornar true aqui?
| public static String extractValueFromXml(String name, HttpServletRequest request) { | ||
| @Override | ||
| public boolean handles(String variable) { | ||
| return variable.startsWith("body."); |
There was a problem hiding this comment.
Mesma coisa, só que pra XML?
There was a problem hiding this comment.
Sim... Quando estava refatorando pensei em fazer isso. Melhoraria a performance pois evitaria o extract. Mas se o extract retorna null a gente também tenta avaliar os próximos Resolvers.
Teríamos que ou mudar o nome da variável para body.json ou body.xml, ou passar o Request e escolher baseado no Content-Type. Pessoalmente eu não gostaria de mudar o nome da variável... O que vc acha?
Codecov Report
@@ Coverage Diff @@
## master #7 +/- ##
======================================
Coverage 47.5% 47.5%
======================================
Files 33 32 -1
Lines 381 381
Branches 36 37 +1
======================================
Hits 181 181
Misses 192 192
Partials 8 8
Continue to review full report at Codecov.
|