MKCOL not working in API

I’m trying to create a folder on my server via MKCOL request but I’m having the following problem:

When I use curl everything is fine:
curl -X MKCOL -k -u user:passwd https://hostname/remote.php/dav/files/user/folder-123

Folder folder-123 is created.

But when I do the following request with same params:

request({
  url: 'https://hostname/remote.php/dav/files/user/folder-123',
  type: 'MKCOL',
  username: 'user',
  password: 'passwd'

It fails with 405 Method not allowed.

For some reason, it worked a few times in the beginning but now it always returns error.

Maybe I’m missing something?