Skip to content

Commit 105540d

Browse files
authored
Merge pull request #5 from nschlehe/master
#4 Set response status before calling route handler to avoid overriding status set in handler
2 parents e6ba073 + 078e8f2 commit 105540d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/io/dinject/javalin/generator/MethodReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ void addRoute(Append writer) {
6464
Set<String> pathParams = Util.pathParams(fullPath);
6565

6666
writer.append(" ApiBuilder.%s(\"%s\", ctx -> {", webMethod.name().toLowerCase(), fullPath).eol();
67+
writer.append(" ctx.status(%s);", httpStatusCode()).eol();
6768
for (MethodParam param : params) {
6869
param.buildCtxGet(writer, pathParams);
6970
}
@@ -85,7 +86,6 @@ void addRoute(Append writer) {
8586
writer.append(")");
8687
}
8788
writer.append(";").eol();
88-
writer.append(" ctx.status(%s);", httpStatusCode()).eol();
8989
writer.append(" }");
9090

9191
List<String> roles = roles();

0 commit comments

Comments
 (0)