找到你要的答案

Q:Calculating dynamic value from request body parameters in Paw

Q:从请求体参数计算手爪的动态值

I have methods in my API that have so be signed with hash of request parameters. Let's say I have three params in my request: 'first', 'second' and 'variable', which is set from environment variable. I need to add fourth parameter 'hash', which is equal to MD5([first][second][variable]):

test_var equals to 'test_variable'

To do this I calculate MD5 with Request Parsed Body params, which are read from current request. I get warnings that these params cannot be used because of self-dependency, and that request has an empty body, but MD5 is actually calculated correctly: MD5(firstParamsecondParamtest_variable) = 09f8669986f4152487da543e12e1e393

But, when I send this request hash value changes somehow, and is no longer correct:

first=firstParam&second=secondParam&variable=test_variable&hash=d3a0cc12d51633f07820b9d5ff167126

What's wrong?

我有我的API的方法,所以有与请求参数散列。比方说,我在请求三个参数:“第一”、“二”和“变量”,这是设置环境变量。我需要增加第四个参数“散列”,这等于MD5([一] [二] [变]):

test_var等于“test_variable”

为此我请求解析计算MD5的身体参数,这是从当前请求的读。我得到了警告,这些参数不能使用,因为自我依赖,这就要求有一个空的躯壳,但MD5实际上是计算正确:MD5(firstparamsecondparamtest_variable)= 09f8669986f4152487da543e12e1e393

但是,当我发送这个请求哈希值更改不知何故,并不再正确:

首先firstparam &;二= secondparam &;变量= test_variable &;哈希= d3a0cc12d51633f07820b9d5ff167126

发生了什么?

answer1: 回答1:

It has been fixed in newer versions of Paw. You can simply do like suggested in the question. Right-click and pick Request > Request Parsed Body.

Add all the references you need, and you'll have the wanted hash:

You now have the MD5 of the three first params concatenated (no error reported).

它已被固定在较新版本的爪子。你可以简单地像建议中的问题。右键单击并选择请求>;请求解析体。

添加您需要的所有引用,您将得到所需的哈希值:

你现在有三个参数的MD5级联(没有错误报告)。

paw-app