带有正文表单数据的邮递员请求到 json邮递员、表单、数据、正文

2023-09-07 10:50:20 作者:温柔杀

邮递员有问题...

一方面,我可以使用表单数据中的正文提出此请求.

For one side, I can make this request with the body in form data.

但是,当我尝试使用 raw(json) 中的正文发送相同的请求时,我得到了这个:

But, when I try to send the same request with the body in raw(json) I got this:

我正在尝试通过 Angular 5 将数据发送到 Drupal 8 后端.

I am trying to send the data via Angular 5 to a Drupal 8 Backend.

谢谢!

推荐答案

取决于后端是否可以接收 JSON 格式.

It will depend if the backend can receive a JSON format.

就我而言,我正在使用 Drupal 8 Module simple Oauth.并且 OAuth 2.0 Bearer 令牌的格式实际上在单独的规范中进行了描述,RFC 6750.

In my case, I am working with the Drupal 8 Module simple Oauth. and the The format for OAuth 2.0 Bearer tokens is actually described in a separate spec, RFC 6750.

更具体的这里

实体主体遵循应用程序/x-www-form-urlencoded"由 HTML 定义的内容类型4.01 [W3C.REC-html401-19991224].

The entity-body follows the encoding requirements of the "application/x-www-form-urlencoded" content-type as defined by HTML 4.01 [W3C.REC-html401-19991224].

所以,在我的特殊情况下,我会尝试从 angular 发送表单数据.

So, In my particular case, I will try to send a form-data from angular.

谢谢:让·罗斯坦