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

Servest doesn't work in deno 1.9.0 ? #159

Closed
gamoutatsumi opened this issue Apr 14, 2021 · 2 comments · Fixed by #160
Closed

Servest doesn't work in deno 1.9.0 ? #159

gamoutatsumi opened this issue Apr 14, 2021 · 2 comments · Fixed by #160

Comments

@gamoutatsumi
Copy link
Contributor

I tried this code in deno 1.9.0.

// @deno-types="https://deno.land/x/servest/types/react/index.d.ts"
import React from "https://dev.jspm.io/react/index.js";
// @deno-types="https://deno.land/x/servest/types/react-dom/server/index.d.ts"
import ReactDOMServer from "https://dev.jspm.io/react-dom/server.js";
import { createApp } from "https://deno.land/x/servest/mod.ts";

const app = createApp();
app.handle("/", async (req) => {
  await req.respond({
    status: 200,
    headers: new Headers({
      "content-type": "text/html; charset=UTF-8",
    }),
    body: ReactDOMServer.renderToString(
      <html>
        <head>
          <meta charSet="utf-8" />
          <title>servest</title>
        </head>
        <body>Hello Servest!</body>
      </html>,
    ),
  });
});
app.listen({ port: 8888 });

Just error printed.

error: TS2729 [ERROR]: Property 'boundary' is used before its initialization.
  readonly newLineDashBoundary = encoder.encode(`\r\n--${this.boundary}`);
                                                              ~~~~~~~~
    at https://deno.land/[email protected]/mime/multipart.ts:264:63

    'boundary' is declared here.
      constructor(reader: Deno.Reader, private boundary: string) {
                                       ~~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/[email protected]/mime/multipart.ts:269:36

TS2729 [ERROR]: Property 'boundary' is used before its initialization.
  readonly dashBoundaryDash = encoder.encode(`--${this.boundary}--`);
                                                       ~~~~~~~~
    at https://deno.land/[email protected]/mime/multipart.ts:265:56

    'boundary' is declared here.
      constructor(reader: Deno.Reader, private boundary: string) {
                                       ~~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/[email protected]/mime/multipart.ts:269:36

TS2729 [ERROR]: Property 'boundary' is used before its initialization.
  readonly dashBoundary = encoder.encode(`--${this.boundary}`);
                                                   ~~~~~~~~
    at https://deno.land/[email protected]/mime/multipart.ts:266:52

    'boundary' is declared here.
      constructor(reader: Deno.Reader, private boundary: string) {
                                       ~~~~~~~~~~~~~~~~~~~~~~~~
        at https://deno.land/[email protected]/mime/multipart.ts:269:36

Found 3 errors.

Running with --no-check parameter looks normal, but in fact you got empty response.

Note: #145

$ curl localhost:8888
curl: (52) Empty reply from server

In deno 1.8.3, worked fine.

$ curl localhost:8888
<html data-reactroot=""><head><meta charSet="utf-8"/><title>servest</title></head><body>Hello Servest!</body></html>%
@keroxp
Copy link
Owner

keroxp commented Apr 14, 2021

@gamoutatsumi Oops, it seems to come from tsc's upgrade. I hope bumping std's version resolves the issue...

@gamoutatsumi
Copy link
Contributor Author

That works!
Thanks!

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

Successfully merging a pull request may close this issue.

2 participants