@@ -669,6 +669,18 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
669
669
}
670
670
}
671
671
672
+ " don't fail if we send a null in an optional parameter" in withApiClient { client =>
673
+ val json = """ {"name":"wiringbits","email":null,"password":"wiringbits"}"""
674
+ val path = s " /admin/tables/ ${usersSettings.tableName}"
675
+ val response = POST (path, json).futureValue
676
+ response.header.status mustBe 200
677
+
678
+ val responseMetadata =
679
+ client.getTableMetadata(usersSettings.tableName, List (" name" , " ASC" ), List (0 , 9 ), " {}" ).futureValue
680
+
681
+ responseMetadata.head.nonEmpty mustBe true
682
+ }
683
+
672
684
" return new user id" in withApiClient { implicit client =>
673
685
val user = createUser.futureValue
674
686
val response = client.getTableMetadata(usersSettings.tableName, List (" name" , " ASC" ), List (0 , 9 ), " {}" ).futureValue
@@ -788,6 +800,27 @@ class AdminControllerSpec extends PlayPostgresSpec with AdminUtils {
788
800
}
789
801
}
790
802
803
+ " don't fail if we send a null in an optional parameter" in withApiClient { client =>
804
+ val name = " wiringbits"
805
+
806
+ val password = " wiringbits"
807
+ val request = AdminCreateTable .Request (Map (" name" -> name, " email" -> email, " password" -> password))
808
+ client.createItem(" users" , request).futureValue
809
+ val responseMetadata1 =
810
+ client.getTableMetadata(usersSettings.tableName, List (" name" , " ASC" ), List (0 , 9 ), " {}" ).futureValue
811
+ val id = responseMetadata1.head(" id" )
812
+
813
+ val json = """ {"email":null}"""
814
+ val path = s " /admin/tables/ ${usersSettings.tableName}/ $id"
815
+ val response = PUT (path, json).futureValue
816
+ response.header.status mustBe 200
817
+
818
+ val responseMetadata2 =
819
+ client.getTableMetadata(usersSettings.tableName, List (" name" , " ASC" ), List (0 , 9 ), " {}" ).futureValue
820
+
821
+ responseMetadata2.head(" email" ) mustBe " "
822
+ }
823
+
791
824
" fail if the field in body doesn't exists" in withApiClient { client =>
792
825
val request = AdminCreateTable .Request (
793
826
Map (
" name" -> " wiringbits" ,
" email" -> " [email protected] " ,
" password" -> " wiringbits" )
0 commit comments