#1 2026-01-09 19:45:23

mrbar2000
Member
From: Brazil
Registered: 2016-10-26
Posts: 123

Why PUT and Delete dont work anymore?

I have update my sources, it is very old!

Now my application dont accept PUT and DELETE. just Get and POST

Offline

#2 2026-01-10 09:42:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,411
Website

Re: Why PUT and Delete dont work anymore?

On which part of the framework?
REST-methods? REST-interfaces? MVC?
Please always debug a little and give some context.

There was some tuning to reduce memory usage and CPU consumption at startup.
But it should not affect regular process.

Offline

#3 2026-01-10 12:30:55

mrbar2000
Member
From: Brazil
Registered: 2016-10-26
Posts: 123

Re: Why PUT and Delete dont work anymore?

Rest Interfaces.
I put .AcceptMethods([mGet,mPUT,mPost,mDelete]) in my registerservice. and now works.

I dont know if is the better  place, but works. was hours of debug and looking mormot code! I look at documentation but i cannot found nothing about!

Offline

#4 2026-01-10 17:05:19

JD
Member
Registered: 2015-08-20
Posts: 129

Re: Why PUT and Delete dont work anymore?

I have the same problem. I have an old mORMot 2.3.11038 which works, and I wanted to update it, I've tried mORMot 2.3.13041 and mORMot 2.3.13309, but I had to go back to my old version because PUT does not work in my REST interface server.

Initially trying to do a PUT in one of those versions gave me a 401 Unauthorized error, but the last one gives a 405 Method Not Allowed error.

@mbar2000 Where did you add the AcceptMethods([mGet,mPUT,mPost,mDelete]) to the service?

Thanks,

JD

Offline

#5 2026-01-10 18:43:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,411
Website

Re: Why PUT and Delete dont work anymore?

I guess he meant TServiceFactoryServerAbstract.SetMethods() as documented:

    /// define the HTTP methods used for TRestServerUriContext.UriComputeRoutes
    /// - by default, only [mGET, mPOST] are allowed, but you can set any other
    // set, e.g. [mGET, mPOST, mPUT, mDELETE] if you want to allow more HTTP verbs
    // - this method returns self in order to allow direct chaining of settings
    // calls, in a fluent interface
    function SetMethods(const aMethods: TUriMethods): TServiceFactoryServerAbstract;

Offline

#6 2026-01-13 09:02:31

JD
Member
Registered: 2015-08-20
Posts: 129

Re: Why PUT and Delete dont work anymore?

Thanks @ab

I added the following line to my server define

    // In recent mORMot versions, e.g after version mORMot 2.3.11038 only the mGET and mPOST methods are allowed by default
    // The line below adds two extra methods, mPUT and mDELETE so that calls to these methods
    // will not give a 401 Unauthorized OR 405 Method Not Allowed error
    ServiceFactoryServer.SetMethods([mGET, mPOST, mPUT, mDELETE]);

It looks OK now. In addition, I've moved to the latest mORMot 2.4 stable. Thanks a lot to the mORMot community for all their hard work.

Last edited by JD (2026-01-13 14:50:49)

Offline

Board footer

Powered by FluxBB