fix: unserializable objects in HTTP-responses
All checks were successful
.NET Tests / test (push) Successful in 1m18s
All checks were successful
.NET Tests / test (push) Successful in 1m18s
This commit is contained in:
parent
421d33df99
commit
ce4e5848db
@ -17,7 +17,7 @@ public class StreetController : ControllerBase
|
||||
public async Task<IActionResult> CreateStreet([FromBody] CreateStreetDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
return BadRequest("Invalid request body.");
|
||||
return BadRequest();
|
||||
|
||||
try
|
||||
{
|
||||
@ -28,9 +28,9 @@ public class StreetController : ControllerBase
|
||||
|
||||
return Created();
|
||||
}
|
||||
catch (InvalidOperationException ex)
|
||||
catch
|
||||
{
|
||||
return Conflict(ex);
|
||||
return Conflict();
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,9 +43,9 @@ public class StreetController : ControllerBase
|
||||
var street = await StreetService.GetStreetAsync(streetname);
|
||||
return Ok(street);
|
||||
}
|
||||
catch (KeyNotFoundException ex)
|
||||
catch
|
||||
{
|
||||
return NotFound(ex);
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public class StreetController : ControllerBase
|
||||
{
|
||||
var deleted = await StreetService.DeleteStreetAsync(streetname);
|
||||
if (!deleted)
|
||||
return NotFound($"Street '{streetname}' not found.");
|
||||
return NotFound();
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
@ -65,24 +65,24 @@ public class StreetController : ControllerBase
|
||||
public async Task<IActionResult> AddPoint(string streetname, [FromBody] AddPointDTO dto)
|
||||
{
|
||||
if (dto == null)
|
||||
return BadRequest("Invalid request body.");
|
||||
return BadRequest();
|
||||
|
||||
try
|
||||
{
|
||||
await StreetService.AddPointAsync(streetname, StreetService.ToGeometryPoint(dto.Point), dto.usePostGIS);
|
||||
return Ok();
|
||||
}
|
||||
catch (KeyNotFoundException ex)
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
return NotFound(ex);
|
||||
return NotFound();
|
||||
}
|
||||
catch (ArgumentException ex)
|
||||
catch (ArgumentException)
|
||||
{
|
||||
return BadRequest(ex);
|
||||
return BadRequest();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Conflict("Concurrency conflict. Please retry your request.");
|
||||
return Conflict();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user