We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
前端代码
import request from 'umi-request'; request.post('/api/test/encryptTransmission/',{ // aes 加密后的字符串 // data:Encrypt(JSON.stringify(reqData)), // rsa 加密后的字符串 // data:jsEncrypt.encrypt(JSON.stringify(reqData)), // json对象 data:reqData, headers:{ Accept:'*/*' } }).then((res)=>{ console.log('1'); })
后端代码 pom.xml
<dependency> <groupId>com.cxytiandi</groupId> <artifactId>monkey-api-encrypt-core</artifactId> <version>1.2.RELEASE</version> </dependency>
springboot主启动类
@SpringBootApplication @MapperScan(basePackages = {"com.iwhalecloud.yn.portal.mapper"}) @EnableEncrypt public class YnPortalServerApplication { // @Resource // private MyRsaEncryptAlgorithm myRsaEncryptAlgorithm; public static void main(String[] args) { SpringApplication.run(YnPortalServerApplication.class, args); } }
TestController
@RestController @RequestMapping("/test") public class TestController { @RequestMapping("/hello") public Result hello() { return Result.buildFail("-440033", "服务器正常返回,但是返回的结果告知服务器或业务不对"); } @Encrypt @PostMapping(path = "/encryptTransmission" ,consumes="application/json") public Result encryptTransmission(@RequestBody MyUserDetails myUserDetails) { return Result.buildSuccess(myUserDetails); } }
测试结果 postman
前端项目
The text was updated successfully, but these errors were encountered:
前端项目的uri多了一个api,这个是后端项目的content-path吗?如果是的话你升级到1.2.2版本
Sorry, something went wrong.
No branches or pull requests
postman请求响应正常,umi-request请求不正常
前端代码
后端代码
pom.xml
springboot主启动类
TestController
测试结果
postman
前端项目
The text was updated successfully, but these errors were encountered: