<tfoot id='hRCl2'></tfoot>

        <bdo id='hRCl2'></bdo><ul id='hRCl2'></ul>
      <legend id='hRCl2'><style id='hRCl2'><dir id='hRCl2'><q id='hRCl2'></q></dir></style></legend>

      <small id='hRCl2'></small><noframes id='hRCl2'>

    1. <i id='hRCl2'><tr id='hRCl2'><dt id='hRCl2'><q id='hRCl2'><span id='hRCl2'><b id='hRCl2'><form id='hRCl2'><ins id='hRCl2'></ins><ul id='hRCl2'></ul><sub id='hRCl2'></sub></form><legend id='hRCl2'></legend><bdo id='hRCl2'><pre id='hRCl2'><center id='hRCl2'></center></pre></bdo></b><th id='hRCl2'></th></span></q></dt></tr></i><div id='hRCl2'><tfoot id='hRCl2'></tfoot><dl id='hRCl2'><fieldset id='hRCl2'></fieldset></dl></div>

    2. 如何在 PostMan 的预请求脚本中计算 md5 哈希?

      How to compute a md5 hash in a pre-request script in PostMan?(如何在 PostMan 的预请求脚本中计算 md5 哈希?)
      <tfoot id='Ya8ie'></tfoot>

        <small id='Ya8ie'></small><noframes id='Ya8ie'>

          <i id='Ya8ie'><tr id='Ya8ie'><dt id='Ya8ie'><q id='Ya8ie'><span id='Ya8ie'><b id='Ya8ie'><form id='Ya8ie'><ins id='Ya8ie'></ins><ul id='Ya8ie'></ul><sub id='Ya8ie'></sub></form><legend id='Ya8ie'></legend><bdo id='Ya8ie'><pre id='Ya8ie'><center id='Ya8ie'></center></pre></bdo></b><th id='Ya8ie'></th></span></q></dt></tr></i><div id='Ya8ie'><tfoot id='Ya8ie'></tfoot><dl id='Ya8ie'><fieldset id='Ya8ie'></fieldset></dl></div>

                <tbody id='Ya8ie'></tbody>

              <legend id='Ya8ie'><style id='Ya8ie'><dir id='Ya8ie'><q id='Ya8ie'></q></dir></style></legend>

              • <bdo id='Ya8ie'></bdo><ul id='Ya8ie'></ul>
                本文介绍了如何在 PostMan 的预请求脚本中计算 md5 哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我必须在我的请求中设置一个参数,该参数是其他两个参数的 md5 哈希.我认为预请求脚本可以完成这项工作,但我不知道如何在这个脚本中计算 md5.有什么想法吗?

                解决方案

                如果您的参数是定义的环境变量,您可以创建以下预请求脚本.如果以其他方式定义它们,则需要调整此示例.

                //像这样访问你的环境变量var str_1 = environment.variable_1 + environment.variable_2;//或者获取你的请求参数var str_2 = request.data["foo"] + request.data["bar"];//使用 CryptoJSvar hash = CryptoJS.MD5(str_1 + str_2).toString();//设置新的环境变量postman.setEnvironmentVariable('hash', hash);

                CryptoJS 之所以有效,是因为它在 Postman(以及 lodash、backbone 等)中可用.

                通过 environment 对象可以轻松访问环境变量.

                通过 postman 对象可以设置环境变量.

                在此预请求运行后,您可以使用普通的 {{hash}} 简写访问 hash 变量.

                此外,您还可以阅读此处了解 Postman 中可用的库、变量和属性.p>

                I have to set a parameter in my request that is a md5 hash of two other parameters. I think a pre-request script can do the job, but I do not know how to compute a md5 in this script. Any idea?

                解决方案

                You can create the following pre-request script provided your parameters are defined environment variables. You would need to tweak this example if they are defined in some other fashion.

                // Access your env variables like this
                var str_1 = environment.variable_1 + environment.variable_2;
                
                // Or get your request parameters
                var str_2 = request.data["foo"] + request.data["bar"];
                
                // Use the CryptoJS
                var hash = CryptoJS.MD5(str_1 + str_2).toString();
                
                // Set the new environment variable
                postman.setEnvironmentVariable('hash', hash);
                

                CryptoJS works because it's available in Postman (as well as lodash, backbone etc).

                Accessing environment variables is easy through the environment object.

                Setting environment variables is available through the postman object.

                After this pre-request has run you can access the hash variable using the normal {{hash}} shorthand.

                Also, you can read here about libraries, variables and properties available in Postman.

                这篇关于如何在 PostMan 的预请求脚本中计算 md5 哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                Ordinals in words javascript(javascript中的序数)
                getFullYear returns year before on first day of year(getFullYear 在一年的第一天返回前一年)
                  <tbody id='L1EA5'></tbody>

                • <i id='L1EA5'><tr id='L1EA5'><dt id='L1EA5'><q id='L1EA5'><span id='L1EA5'><b id='L1EA5'><form id='L1EA5'><ins id='L1EA5'></ins><ul id='L1EA5'></ul><sub id='L1EA5'></sub></form><legend id='L1EA5'></legend><bdo id='L1EA5'><pre id='L1EA5'><center id='L1EA5'></center></pre></bdo></b><th id='L1EA5'></th></span></q></dt></tr></i><div id='L1EA5'><tfoot id='L1EA5'></tfoot><dl id='L1EA5'><fieldset id='L1EA5'></fieldset></dl></div>

                  <legend id='L1EA5'><style id='L1EA5'><dir id='L1EA5'><q id='L1EA5'></q></dir></style></legend>
                  • <small id='L1EA5'></small><noframes id='L1EA5'>

                    <tfoot id='L1EA5'></tfoot>

                        <bdo id='L1EA5'></bdo><ul id='L1EA5'></ul>