Skip to content

Commit adf9883

Browse files
modified to reply NotFound when it can not invoke the action
1 parent 1a253fa commit adf9883

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/tactioncontext.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ void TActionContext::execute(THttpRequest &request)
168168
// Do filters
169169
if (Q_LIKELY(_currController->preFilter())) {
170170
// Dispatches
171-
ctlrDispatcher.invoke(route.action, route.params);
171+
bool inv = ctlrDispatcher.invoke(route.action, route.params);
172+
if (!inv) {
173+
int bytes = writeResponse(Tf::NotFound, responseHeader);
174+
accessLogger.setResponseBytes(bytes);
175+
}
172176
}
173177

174178
// Flushes response

src/tdispatcher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ inline bool TDispatcher<T>::invoke(const QByteArray &method, const QStringList &
119119
QMetaMethod mm = this->method(method, args.count());
120120

121121
if (Q_UNLIKELY(!mm.isValid())) {
122-
tSystemDebug("No such method: %s", qUtf8Printable(method));
122+
tSystemDebug("Failed to invoke method: %s", qUtf8Printable(method));
123123
} else {
124124
tSystemDebug("Invoke method: %s", qUtf8Printable(_metaType + "." + method));
125125
switch (args.count()) {

0 commit comments

Comments
 (0)