Skip to content

Commit 8a95a97

Browse files
authored
[ISSUE #203]🐛Fix RequestHeaderCodec macro can not work (#204)
1 parent 8c8bd7a commit 8a95a97

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

rocketmq-macros/src/request_header_custom.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,22 @@ pub(super) fn request_header_codec_inner(
5555
const #static_name: &'static str = #camel_case_name;
5656
},
5757
(
58-
if has_option.is_some() {
59-
quote! {
58+
if let Some(value) = has_option {
59+
let type_name = get_type_name(value);
60+
if type_name == "String" {
61+
quote! {
62+
if let Some(ref value) = self.#field_name {
63+
map.insert (Self::#static_name.to_string(),value.to_string());
64+
}
65+
}
66+
}else {
67+
quote! {
6068
if let Some(value) = self.#field_name {
6169
map.insert (Self::#static_name.to_string(),value.to_string());
6270
}
6371
}
72+
}
73+
6474
} else {
6575
quote! {
6676
map.insert (Self::#static_name.to_string(),self.#field_name.to_string());

0 commit comments

Comments
 (0)