WSClientSDK { public static Map<String, String> generateSignHeaders(WSParams params) { Map<String, String> extSignHeaderMap = genExtHeader(params.getFingerPrinter()); Map<String, String> requestHeaders = SignUtil.newParamsMap(null, params.getApi(), params.getVersion(), params.getAk(), params.getSk(), params.isTimestamp(), params.isNonce(), extSignHeaderMap, null, params.getSignImpl(),params.getVerifySignImpl()); if (params.isMockRequest()) { requestHeaders.put(CsbSDKConstants.HEADER_MOCK, "true"); } return requestHeaders; }  static synchronized void warmup(); static void bizIdKey(String bizIdKey); static String bizIdKey(); static T bind(T proxy, String accessKey, String secretKey); static T bind(T proxy, WSParams params); static Object bind(T proxy, WSParams params); static T bind(T proxy, String accessKey, String secretKey, String apiName, String apiVersion, boolean printHeaders); static T bind(T proxy, String accessKey, String secretKey, String apiName, String apiVersion); static T setResponseMock(T proxy, boolean isMock); static Map<String, String> genExtHeader(String fingerStr); static Map<String, String> generateSignHeaders(WSParams params); static final boolean PRINT_SIGNINFO; }
@Test public void testSignHeaders() { WSParams params = WSParams.create(); params.api("api"); params.version("1.0.0"); params.accessKey("ak"); params.secretKey("sk"); params.nonce(true); params.fingerPrinter("wiseking"); Map<String, String> headers = WSClientSDK.generateSignHeaders(params); System.out.println(headers); Assert.assertTrue("must include api", headers.containsKey(CsbSDKConstants.API_NAME_KEY)); }
@Test public void testSignHeaders2() { WSParams params = WSParams.create(); params.accessKey("ak"); params.secretKey("sk"); params.fingerPrinter("wiseking"); params.timestamp(false); Map<String, String> headers = WSClientSDK.generateSignHeaders(params); System.out.println(headers); Assert.assertTrue("can not include api", !headers.containsKey(CsbSDKConstants.API_NAME_KEY)); }