本文介绍了body-parser - 扩展选项(qs vs querystring)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在当前版本的中,扩展选项当使用 bodyParser.urlencoded()现在需要。在README中,它解释:

In the current version of body-parser, the extended option when using bodyParser.urlencoded() is now required. In the README, it explains:

[...]

默认为true,但使用默认值已被弃用。请研究qs和querystring之间的区别,并选择适当的设置。

Defaults to true, but using the default has been deprecated. Please research into the difference between qs and querystring and choose the appropriate setting.

我找不到任何有用的或具体的信息。我只发现一个已弃用的。

I couldn't find any helpful or specific information on this. I only found a deprecated node-querystring.

应该这个选项一直是真的?

Should this option just always be true?

推荐答案

此消息的原因是 body-parser 是。

The reason for this message is that body-parser is about to change default value for extended from true to false.

扩展协议使用提供基本的序列化/反序列化算法,所有网络浏览器使用的序列化表单数据。这个基本算法比扩展的算法要简单得多,但局限于平面数据结构。

querystring library` provides basic serialization/deserialization algorithm, the one used by all web-browsers to serialize form data. This basic algorithm is significantly simpler than extended one, but limited to flat data structures.

这两种算法与平面数据完全相同。

Both algorithms work exactly the same with flat data.

现在,当您了解这两种算法的优缺点时,您可以决定哪一种适合您的应用程序。

Now, when you know pros and cons of both algorithms, it's up to you to decide which one suits your application better.

这篇关于body-parser - 扩展选项(qs vs querystring)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 05:29
查看更多