Skip to content
New issue

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

httpHeaders.add("Operationid", ""); 这块有问题 #2

Closed
huazaihuola opened this issue Sep 20, 2023 · 2 comments
Closed

httpHeaders.add("Operationid", ""); 这块有问题 #2

huazaihuola opened this issue Sep 20, 2023 · 2 comments

Comments

@huazaihuola
Copy link

httpHeaders.add("Operationid", ""); 这块有问题,若是在api 模式下,这块没有Operationid 为空会返回报错,必须要有这个Id 。

@huazaihuola
Copy link
Author

public OpenImResult userRegister(UserRegisterReq req) {
long time = System.currentTimeMillis();
String apiUrl = this.openimConfig.getApiUrl(SERVER_TYPE);
String url = CommUtils.appendUrl(apiUrl, "/user/user_register");
HttpHeaders httpHeaders = new HttpHeaders();
### httpHeaders.add("Operationid", "");
if (StringUtils.isBlank(req.getSecret())) {
req.setSecret(this.openimConfig.getSecret());
}

    String body = JSONUtil.toJsonStr(req);
    HttpEntity<String> formEntity = new HttpEntity(body, httpHeaders);
    ResponseEntity<String> exchanges = HttpRequestUtils.exchange(url, HttpMethod.POST, formEntity, String.class);
    OpenImResult<String> openImResult = (OpenImResult)JSONUtil.toBean((String)exchanges.getBody(), new TypeReference<OpenImResult<String>>() {
    }, false);
    if (!openImResult.isOk()) {
        log.warn("----userRegister--body={} time={} result={}", new Object[]{body, System.currentTimeMillis() - time, exchanges.getBody()});
    }

    return openImResult;
}

@asgardjh
Copy link
Collaborator

已处理,新版已发布

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants