代码之家  ›  专栏  ›  技术社区  ›  Majid Dehnamaki

邮递员发送实体模型

  •  7
  • Majid Dehnamaki  · 技术社区  · 8 年前

    我创建了一个web API,想和postman一起检查,但不知道如何发布我的实体模型。始终模型为空

    我使用[FromForm]发送给我模型,但所有值都为null,并且使用[Frombody] 发送空值

    1 回复  |  直到 8 年前
        1
  •  12
  •   federico scamuzzi    8 年前

    . your error is the CONTENT TYPE you're using to send the request .. 您选择 x-www-form-url-encoded (HTML表单的格式)。。 BUT if you want to use WebAPI and send your Entity in the PAYLOAD of yours request via REST .. you have to set CONTENT - TYPE as application/JSON ..

    所以 in POSTMAN do:

    1-选择类型 RAW

    2-在出现的下拉列表中选择 application/json

    3- paste your JSON in the Text Area

    4- send it

    希望它能帮助你!!

    推荐文章