allow paths that contain '.' (#125)
* allow paths that contain '.' * remove InvalidPathWithDotShouldThrowException test
This commit is contained in:
parent
478c640a68
commit
70c8133fce
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Internal
|
||||||
// absolutely necessary, but it allows us to already catch mistakes
|
// absolutely necessary, but it allows us to already catch mistakes
|
||||||
// on creation of the patch document rather than on execute.
|
// on creation of the patch document rather than on execute.
|
||||||
|
|
||||||
if (path.Contains(".") || path.Contains("//") || path.Contains(" ") || path.Contains("\\"))
|
if (path.Contains("//") || path.Contains(" ") || path.Contains("\\"))
|
||||||
{
|
{
|
||||||
throw new JsonPatchException(Resources.FormatInvalidValueForPath(path), null);
|
throw new JsonPatchException(Resources.FormatInvalidValueForPath(path), null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,24 +45,6 @@ namespace Microsoft.AspNetCore.JsonPatch
|
||||||
exception.Message);
|
exception.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void InvalidPathWithDotShouldThrowException()
|
|
||||||
{
|
|
||||||
// Arrange
|
|
||||||
var patchDocument = new JsonPatchDocument();
|
|
||||||
|
|
||||||
// Act
|
|
||||||
var exception = Assert.Throws<JsonPatchException>(() =>
|
|
||||||
{
|
|
||||||
patchDocument.Add("NewInt.Test", 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
Assert.Equal(
|
|
||||||
"The provided string 'NewInt.Test' is an invalid path.",
|
|
||||||
exception.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void NonGenericPatchDocToGenericMustSerialize()
|
public void NonGenericPatchDocToGenericMustSerialize()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue