File tree Expand file tree Collapse file tree
modules/openapi-generator/src
main/resources/erlang-server
test/java/org/openapitools/codegen/erlang Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ is_authorized(Req, State) ->
9191 { {#consumes.size} }
9292 { [
9393 {{#consumes} }
94- { << " {{mediaType}}" >> , handle_type_accepted} { {^-last} }{ {#consumes.size} },{ {/consumes.size} }{ {/-last} }
94+ { << " {{{ mediaType} }}" >> , handle_type_accepted} { {^-last} }{ {#consumes.size} },{ {/consumes.size} }{ {/-last} }
9595 { {/consumes} }
9696 ], Req, State};
9797 { {/consumes.size} }
@@ -114,7 +114,7 @@ is_authorized(Req, State) ->
114114 { {#produces.size} }
115115 { [
116116 {{#produces} }
117- { << " {{mediaType}}" >> , handle_type_provided} { {^-last} }{ {#produces.size} },{ {/produces.size} }{ {/-last} }
117+ { << " {{{ mediaType} }}" >> , handle_type_provided} { {^-last} }{ {#produces.size} },{ {/produces.size} }{ {/-last} }
118118 { {/produces} }
119119 ], Req, State};
120120 { {/produces.size} }
Original file line number Diff line number Diff line change 1+ package org .openapitools .codegen .erlang ;
2+
3+ import org .openapitools .codegen .ClientOptInput ;
4+ import org .openapitools .codegen .DefaultGenerator ;
5+ import org .openapitools .codegen .config .CodegenConfigurator ;
6+ import org .testng .annotations .Test ;
7+
8+ import java .io .File ;
9+ import java .nio .file .Path ;
10+ import java .util .List ;
11+
12+ import static org .assertj .core .api .Assertions .assertThat ;
13+ import static org .openapitools .codegen .TestUtils .newTempFolder ;
14+
15+ public class ErlangServerCodegenTest {
16+
17+ @ Test
18+ public void testCharsetInContentTypeCorrectlyEncodedForErlangServer () {
19+ final Path output = newTempFolder ();
20+ final CodegenConfigurator configurator = new CodegenConfigurator ()
21+ .setGeneratorName ("erlang-server" )
22+ .setInputSpec ("src/test/resources/3_0/issue_19895.yaml" )
23+ .setOutputDir (output .toString ().replace ("\\ " , "/" ));
24+
25+ final ClientOptInput clientOptInput = configurator .toClientOptInput ();
26+ DefaultGenerator generator = new DefaultGenerator ();
27+ List <File > files = generator .opts (clientOptInput ).generate ();
28+
29+ var defaultApiFile = output .resolve ("src/openapi_default_handler.erl" );
30+ assertThat (files ).contains (defaultApiFile .toFile ());
31+ assertThat (defaultApiFile ).content ()
32+ .doesNotContain (
33+ "application/json;charset=utf-8" )
34+ .contains (
35+ "application/json;charset=utf-8"
36+ );
37+ }
38+
39+ }
You can’t perform that action at this time.
0 commit comments