Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
amrani
jio
Commits
d85fc772
Commit
d85fc772
authored
Aug 25, 2015
by
lucas.parsy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davstorage: Don't fail when put an existing document and add test related
parent
c73d13c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
4 deletions
+35
-4
src/jio.storage/davstorage.js
src/jio.storage/davstorage.js
+15
-4
test/jio.storage/davstorage.tests.js
test/jio.storage/davstorage.tests.js
+20
-0
No files found.
src/jio.storage/davstorage.js
View file @
d85fc772
...
@@ -82,16 +82,27 @@
...
@@ -82,16 +82,27 @@
}
}
DavStorage
.
prototype
.
put
=
function
(
id
,
param
)
{
DavStorage
.
prototype
.
put
=
function
(
id
,
param
)
{
var
that
=
this
;
id
=
restrictDocumentId
(
id
);
id
=
restrictDocumentId
(
id
);
if
(
Object
.
getOwnPropertyNames
(
param
).
length
>
0
)
{
if
(
Object
.
getOwnPropertyNames
(
param
).
length
>
0
)
{
// Reject if param has some properties
// Reject if param has some properties
throw
new
jIO
.
util
.
jIOError
(
"
Can not store properties:
"
+
throw
new
jIO
.
util
.
jIOError
(
"
Can not store properties:
"
+
Object
.
getOwnPropertyNames
(
param
),
400
);
Object
.
getOwnPropertyNames
(
param
),
400
);
}
}
return
ajax
(
this
,
{
return
new
RSVP
.
Queue
()
type
:
"
MKCOL
"
,
.
push
(
function
()
{
url
:
this
.
_url
+
id
return
ajax
(
that
,
{
});
type
:
"
MKCOL
"
,
url
:
that
.
_url
+
id
});
})
.
push
(
undefined
,
function
(
err
)
{
if
((
err
.
target
!==
undefined
)
&&
(
err
.
target
.
status
===
405
))
{
return
;
}
throw
err
;
});
};
};
DavStorage
.
prototype
.
remove
=
function
(
id
)
{
DavStorage
.
prototype
.
remove
=
function
(
id
)
{
...
...
test/jio.storage/davstorage.tests.js
View file @
d85fc772
...
@@ -94,6 +94,26 @@
...
@@ -94,6 +94,26 @@
});
});
});
});
test
(
"
don't throw error when putting existing directory
"
,
function
()
{
var
url
=
domain
+
"
/existing/
"
,
server
=
this
.
server
;
this
.
server
.
respondWith
(
"
MKCOL
"
,
url
,
[
405
,
{
"
Content-Type
"
:
"
text/xml
"
},
"
MKCOL https://example.org/existing/ 405 (Method Not Allowed)
"
]);
stop
();
expect
(
1
);
this
.
jio
.
put
(
"
/existing/
"
,
{})
.
then
(
function
()
{
equal
(
server
.
requests
[
0
].
status
,
405
);
})
.
fail
(
function
(
error
)
{
ok
(
false
,
error
);
})
.
always
(
function
()
{
start
();
});
});
test
(
"
reject ID not starting with /
"
,
function
()
{
test
(
"
reject ID not starting with /
"
,
function
()
{
stop
();
stop
();
expect
(
3
);
expect
(
3
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment