Skip to content

Commit

Permalink
[ISSUE #203]🐛Fix RequestHeaderCodec macro can not work (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsm authored Feb 16, 2024
1 parent 8c8bd7a commit 8a95a97
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions rocketmq-macros/src/request_header_custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,22 @@ pub(super) fn request_header_codec_inner(
const #static_name: &'static str = #camel_case_name;
},
(
if has_option.is_some() {
quote! {
if let Some(value) = has_option {
let type_name = get_type_name(value);
if type_name == "String" {
quote! {
if let Some(ref value) = self.#field_name {
map.insert (Self::#static_name.to_string(),value.to_string());
}
}
}else {
quote! {
if let Some(value) = self.#field_name {
map.insert (Self::#static_name.to_string(),value.to_string());
}
}
}

} else {
quote! {
map.insert (Self::#static_name.to_string(),self.#field_name.to_string());
Expand Down

0 comments on commit 8a95a97

Please sign in to comment.