-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #827 from Hans-Wu-cn/master
fix: It is suspected that the curl request generated under a single file cannot obtain the header correctly. Currently, the debug execution is successful under multiple files, and the curl command generated by copying cannot be requested. Changing to double quotation marks is normal
- Loading branch information
Showing
2 changed files
with
33 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.ly.doc.util; | ||
|
||
import com.ly.doc.constants.ApiReqParamInTypeEnum; | ||
import com.ly.doc.model.ApiReqParam; | ||
import com.ly.doc.model.request.CurlRequest; | ||
import com.ly.doc.utils.CurlUtil; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Arrays; | ||
|
||
public class CurlUtilTest { | ||
/** | ||
* test header name | ||
*/ | ||
@Test | ||
public void testHeaderName() { | ||
ApiReqParam apiReqParam = ApiReqParam.builder() | ||
.setName("Authorization") | ||
.setValue("lbEfFvLigPuN2pDMxWaTviVuGwhg74T11geUiNcaYwZ4ZAZB780vkQo8OBMVpZmT") | ||
.setParamIn(ApiReqParamInTypeEnum.HEADER.getValue()); | ||
CurlRequest builder = CurlRequest.builder(); | ||
builder.setUrl("http://127.0.0.1:8080/region/list") | ||
.setType("POST") | ||
.setContentType("application/json") | ||
.setReqHeaders(Arrays.asList(apiReqParam)); | ||
String curl = CurlUtil.toCurl(builder); | ||
System.out.println(curl); | ||
} | ||
} |