A strange thing happens to me, I have published an api with swagger, in a post method I have a body with some properties that are a string, in my api I check if one of them is null, in my local everything works fine, both in swagger and postman, but when I publish the api, setting the first parameter to null gives me a 400 Bad Request.
I leave the code of the controller
[HttpPost]
public async Task<IActionResult> Message([FromBody]MessageFirebaseRequest messageFirebaseRequest)
{
var firebaseMessaging = FirebaseMessaging.GetMessaging(_firebaseApp);
var data = new Dictionary<string, string>
{
{ "body", messageFirebaseRequest.Message },
{ "alert", messageFirebaseRequest.Alert.ToString() },
{ "priority", "high" },
{ "other_key", "true" }
};
if (messageFirebaseRequest.Silent)
{
data.Add("silent", "true");
}
var message = new Message
{
Data = data,
Android = new AndroidConfig
{
Priority = Priority.High
}
};
if (messageFirebaseRequest.Topic is null)
{
message.Token = messageFirebaseRequest.Token;
}
else
{
message.Topic = messageFirebaseRequest.Topic;
}
string result = await firebaseMessaging.SendAsync(message);
return Ok(result);
}