doukengzi3517 2014-09-27 02:30
浏览 48

从POST返回ID

I've built a web app in angularjs and a service layer using Go and App Engine but I've run into a snag. Angular doesn't seem to recognize the HTTP status 201 (Created) nor the Location header it populates and the gorest library that I've been using up until now will not return any body data for a POST or PUT except for the header on a 201 Create response.

I want to be able to add a new item to a collection in my app and have the server respond with the unique ID for it.

I could make a separate GET request after the POST comes back but that's inefficient and messy. I could also fix the gorest code to allow a body in a response for a non GET verb but it might be that I'm breaking idiomatic standards.

Is there anything I'm missing here?

  • 写回答

2条回答 默认 最新

  • douliang1900 2014-09-27 03:22
    关注

    There's a closed issue on angular.js's issue tracker, they pretty much don't care about that feature.

    评论

报告相同问题?

悬赏问题

  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答