Skip to content

(Nima) Fix Header Generation #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void writeReadParameter(Append writer, ParamType paramType, String paramN
writer.append("formParams.first(\"%s\").orElse(null)", paramName);
break;
case HEADER:
writer.append("req.headers().value(Http.Header.create(\"%s\").orElse(null)", paramName);
writer.append("req.headers().value(io.helidon.common.http.Http.Header.create(\"%s\")).orElse(null)", paramName);
break;
case COOKIE:
writer.append("req.headers().cookies().first(\"%s\").orElse(null)", paramName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.avaje.http.api.Controller;
import io.avaje.http.api.Form;
import io.avaje.http.api.Get;
import io.avaje.http.api.Header;
import io.avaje.http.api.MediaType;
import io.avaje.http.api.Post;
import io.avaje.http.api.Produces;
Expand Down Expand Up @@ -38,6 +39,7 @@ byte[] testBytes() {

@Get("/helidon")
void testHelidon(ServerRequest req, ServerResponse res) {

res.headers().contentType(HttpMediaType.TEXT_PLAIN);
res.send("success path:" + req.path());
}
Expand All @@ -47,6 +49,11 @@ void testVoid(ServerResponse res) {
res.send("GET-Returning-void");
}

@Get("/header")
String testHeader(@Header String head) {
return head;
}

// curl -v localhost:8081/person/jack
@Get("person/{name}")
Person person(String name) {
Expand Down