Don't leak data when we aren't in Development mode
This commit is contained in:
parent
9cb97b699e
commit
5d206ded1b
|
|
@ -19,17 +19,25 @@ namespace TwilioSMSReceiver.Controllers
|
|||
{
|
||||
private readonly SMSDbCtx _context;
|
||||
private readonly IEnumerable<IMessageHandler> _messageHandlers;
|
||||
public SMSReceiverController(SMSDbCtx context, IEnumerable<IMessageHandler> messageHandlers)
|
||||
private readonly IWebHostEnvironment _environment;
|
||||
|
||||
public SMSReceiverController(SMSDbCtx context, IEnumerable<IMessageHandler> messageHandlers,
|
||||
IWebHostEnvironment environment)
|
||||
{
|
||||
_context = context;
|
||||
_messageHandlers = messageHandlers;
|
||||
_environment = environment;
|
||||
}
|
||||
|
||||
// GET: api/SMSReceiver
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<SMSModel>>> GetSMSMessages()
|
||||
{
|
||||
return await _context.SMSMessages.Include(b => b.MMSContent).ToListAsync();
|
||||
if (_environment.IsDevelopment())
|
||||
{
|
||||
return await _context.SMSMessages.Include(b => b.MMSContent).ToListAsync();
|
||||
}
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
// GET: api/SMSReceiver/5
|
||||
|
|
|
|||
Loading…
Reference in New Issue