Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-105329

QHttpServer: returning a value from a route handler should be an error when the function uses a QHttpServerResponder

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 6.4.1, 6.5.0 Beta1
    • 6.4.0 Beta2
    • Qt Http Server
    • None
    • All
    • 37dde10311 (qt/qthttpserver/dev) 5e7aabced8 (qt/qthttpserver/6.4) 5e7aabced8 (qt/qthttpserver/6.4.1)
    • Foundation Sprint 65

    Description

      A handler for a route can either return a value from the function which will be used as a response, e.g.

      [](...) {
        return "Hello";
      }
      

      Or it can accept the special QHttpServerResponder object as a parameter.

      [](QHttpServerResponder &&responder) {
        responder.write("hello");
      }
      

      When someone does both, having the QHttpServerResponder argument, as well as trying to return a string, then the return doesn't do anything.

      In fact it should probably be an error to return anything other than void in this case.

      [](**QHttpServerResponder &&responder**) {
        **return** "Hello"; // It would be good if this was a compile time error.
      }
      

      Attachments

        Activity

          People

            ievgenii.meshcheriakov Ievgenii Meshcheriakov
            manordheim MÃ¥rten Nordheim
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: