mauricioaniche / restfulie.net

.net version of restfulie server
http://restfulie.caelum.com.br
Other
50 stars 17 forks source link

Ao retornar um new NotFound() ele retorna a view com model null #4

Closed AlbertoMonteiro closed 12 years ago

AlbertoMonteiro commented 12 years ago

Considere o seguinte código:

    public ActionResult Edicao(long id)
    {
        T lido = repo.Procura(id);
        if (lido == null)
            return new NotFound();
        return new OK(lido);
    }

Usando o $("#container").load() do jQuery, o restfulie tenta retorna a view, e como não foi passado nenhum modelo para a view, é lançado NullReferenceException, chegando erro 500 no client.

Deveria retorna um 404, correto?

mauricioaniche commented 12 years ago

Oi Alberto,

Ele deveria retornar 404 sim!

Você quer corrigir o bug? Posso ajudar! ;)

Abraços, Mauricio

2011/12/7 Alberto Monteiro reply@reply.github.com:

Considere o seguinte código:

       public ActionResult Edicao(long id)        {            T lido = repo.Procura(id);            if (lido == null)                return new NotFound();            return new OK(lido);        }

Usando o $("#container").load() do jQuery, o restfulie tenta retorna a view, e como não foi passado nenhum modelo para a view, é lançado NullReferenceException, chegando erro 500 no client.

Deveria retorna um 404, correto?


Reply to this email directly or view it on GitHub: https://github.com/mauricioaniche/restfulie.net/issues/4

Mauricio Aniche www.aniche.com.br @mauricioaniche

AlbertoMonteiro commented 12 years ago

Vou olhar o código do restfulie e fazer um fork se precisar de ajuda aviso.

AlbertoMonteiro commented 12 years ago

Fiz o pull request, vou fechar esse.