Skip to content

shelf_modular printing FormatException: Unexpected end of input (at character 1) ^ when route isn't found #770

@GabrielCR99

Description

@GabrielCR99

Describe the bug
A clear and concise description of what the bug is.

Environment

[✓] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22000.795], locale en-US)
    • Flutter version 3.0.5 at C:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (9 days ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
    • Android SDK at C:\Users\gabri\AppData\Local\Android\sdk
    • Platform android-33, build-tools 33.0.0-rc1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.1)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.1.32228.430
    • Windows 10 SDK version 10.0.19041.0

[✓] Android Studio (version 2021.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[✓] VS Code (version 1.69.2)
    • VS Code at C:\Users\gabri\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.44.0

[✓] Connected device (3 available)
    • sdk gphone x86 (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • Windows (desktop)       • windows       • windows-x64    • Microsoft Windows [Version 10.0.22000.795]
    • Edge (web)              • edge          • web-javascript • Microsoft Edge 103.0.1264.62

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.

To Reproduce
When defining routes in AppModule, seems like the only route that doesn't print FormatException is Route.get. The others, like this code for example doesn't print in the console.

  @override
  List<ModularRoute> get routes => [
        Route.get(
          '/**',
          (request) => Response.notFound(
            jsonEncode({
              'timestamp': HttpDate.format(DateTime.now()),
              'status': HttpStatus.notFound,
              'message': 'Not found',
              'path': request.url.path,
            }),
          ),
        ),
        Route.get('/docs/**', swaggerHandler),
        Route.module('/user', module: UserModule()),
        Route.module('/auth', module: AuthModule()),
      ];

In the console:

FormatException: Unexpected end of input (at character 1)

^

2022-07-22T18:05:54.941636  0:00:00.000719 POST    [404] /

Expected behavior
Show METHOD [statusCode] without any FormatException

Metadata

Metadata

Assignees

No one assigned

    Labels

    newNew issue request attention

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions