diff --git a/slimapi/slimapi_name_resolver.go b/slimapi/slimapi_name_resolver.go index f17d0fa..d0814b2 100644 --- a/slimapi/slimapi_name_resolver.go +++ b/slimapi/slimapi_name_resolver.go @@ -72,6 +72,9 @@ func (d *slimApiNameResolver) FillMethod(state *webapi.ApiState) { case webapi.ContentTypeForm: requestFormat = meta_RequestFormat_Post + + case webapi.ContentTypeMultipartForm: + requestFormat = meta_RequestFormat_Post } } else { // 指定的 format 串还可包含多段使用逗号隔开的值( e.g. json,plain ), plain 是对应回执的,需单独处理。 diff --git a/slimapi/slimapi_name_resolver_test.go b/slimapi/slimapi_name_resolver_test.go index 05bfb8e..12b7e9d 100644 --- a/slimapi/slimapi_name_resolver_test.go +++ b/slimapi/slimapi_name_resolver_test.go @@ -125,6 +125,14 @@ func Test_slimApiNameResolver_FillMethod(t *testing.T) { callback: "", }) + // Content-Type 分号后的部分被忽略。 + testOne("?~method=name&multi=1", webapi.ContentTypeMultipartForm+"; boundary=----123", want{ + name: "name", + requestFormat: meta_RequestFormat_Post, + responseContentType: webapi.ContentTypeJson, + callback: "", + }) + // Content-Type 分后后的部分被忽略。 testOne("?~method=name&with_charset=1", webapi.ContentTypeForm+"; charset=utf8", want{ name: "name",