Skip to content
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

Generated code for HTTP plugins is broken #56

Open
thedjdoorn opened this issue May 2, 2022 · 0 comments
Open

Generated code for HTTP plugins is broken #56

thedjdoorn opened this issue May 2, 2022 · 0 comments

Comments

@thedjdoorn
Copy link

When one picks the HSTS and CORS plugins (IDEA plugin or online generator, doesn't matter), plugins/HTTP.kt will not compile. This is due to two issues:

Missing imports

io.ktor.server.plugins.hsts.* and io.ktor.server.plugins.cors.routing.* should also be imported, with the latter being quite important, since someone might not read the documentation and import the deprecated option (cors.CORS).

Out-of-date code

The install(CORS) call contains the following:

        method(HttpMethod.Options)
        method(HttpMethod.Put)
        method(HttpMethod.Delete)
        method(HttpMethod.Patch)
        header(HttpHeaders.Authorization)
        header("MyCustomHeader")

This doesn't work. method should be allowMethod, and header should be allowHeader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant