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

Support callback header #1808

Merged
merged 2 commits into from
Aug 10, 2022
Merged

Support callback header #1808

merged 2 commits into from
Aug 10, 2022

Conversation

hellozepp
Copy link
Contributor

添加callback header支持

@hellozepp
Copy link
Contributor Author

hellozepp commented Aug 7, 2022

improve #1793

@hellozepp hellozepp force-pushed the supportCallbackHeader1 branch from dad8bba to f8bd7d7 Compare August 8, 2022 02:02
添加callback header

添加callback header

添加callback header

添加callback header
@hellozepp hellozepp force-pushed the supportCallbackHeader1 branch from f8bd7d7 to 514b8f5 Compare August 8, 2022 02:08

object RestUtils extends Logging with WowLog {
def httpClientPost(urlString: String, data: Map[String, String]): HttpResponse = {
def httpClientPost(urlString: String, data: Map[String, String], headers: Map[String, String]): HttpResponse = {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR comment 带上issue 号吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是说commit吗

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment里面有带

} catch {
case _: Exception =>
logError(s"callbackHeader should be returned normally in the byzer callback!")
System.exit(1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System.exit(1) ? 这里无法assert吗?或者直接抛错?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修复

@@ -178,7 +187,8 @@ class RestController extends ApplicationController with WowLog with Logging {
RestUtils.httpClientPost(urlString,
Map("stat" -> s"""failed""",
"msg" -> (e.getMessage + "\n" + msgBuffer.mkString("\n")),
"jobInfo" -> JSONTool.toJsonStr(jobInfo))),
"jobInfo" -> JSONTool.toJsonStr(jobInfo)),
Map()),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的header为什么是个empty map?

val callbackHeaderString = param("callbackHeader")
var callbackHeader = Map[String,String]()
if (callbackHeaderString != null && callbackHeaderString.nonEmpty){
callbackHeader = JsonUtils.fromJson[Map[String,String]](callbackHeaderString)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里fromJson异常的情况是要block run/script的接口流程吗? 还是要catch住,留个容错模式

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该抛出,callbackHeader设置的不对会影响后续的callback

@hellozepp hellozepp merged commit 783d1f8 into master Aug 10, 2022
@hellozepp hellozepp deleted the supportCallbackHeader1 branch August 23, 2022 04:18
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

Successfully merging this pull request may close these issues.

2 participants