Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ is_authorized(Req, State) ->
{{#consumes.size}}
{[
{{#consumes}}
{<<"{{mediaType}}">>, handle_type_accepted}{{^-last}}{{#consumes.size}},{{/consumes.size}}{{/-last}}
{<<"{{{mediaType}}}">>, handle_type_accepted}{{^-last}}{{#consumes.size}},{{/consumes.size}}{{/-last}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect 👌🏽

{{/consumes}}
], Req, State};
{{/consumes.size}}
Expand All @@ -114,7 +114,7 @@ is_authorized(Req, State) ->
{{#produces.size}}
{[
{{#produces}}
{<<"{{mediaType}}">>, handle_type_provided}{{^-last}}{{#produces.size}},{{/produces.size}}{{/-last}}
{<<"{{{mediaType}}}">>, handle_type_provided}{{^-last}}{{#produces.size}},{{/produces.size}}{{/-last}}
{{/produces}}
], Req, State};
{{/produces.size}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.openapitools.codegen.erlang;

import org.openapitools.codegen.ClientOptInput;
import org.openapitools.codegen.DefaultGenerator;
import org.openapitools.codegen.config.CodegenConfigurator;
import org.testng.annotations.Test;

import java.io.File;
import java.nio.file.Path;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.openapitools.codegen.TestUtils.newTempFolder;

public class ErlangServerCodegenTest {

@Test
public void testCharsetInContentTypeCorrectlyEncodedForErlangServer() {
final Path output = newTempFolder();
final CodegenConfigurator configurator = new CodegenConfigurator()
.setGeneratorName("erlang-server")
.setInputSpec("src/test/resources/3_0/issue_19895.yaml")
.setOutputDir(output.toString().replace("\\", "/"));

final ClientOptInput clientOptInput = configurator.toClientOptInput();
DefaultGenerator generator = new DefaultGenerator();
List<File> files = generator.opts(clientOptInput).generate();

var defaultApiFile = output.resolve("src/openapi_default_handler.erl");
assertThat(files).contains(defaultApiFile.toFile());
assertThat(defaultApiFile).content()
.doesNotContain(
"application/json;charset&#x3D;utf-8")
.contains(
"application/json;charset=utf-8"
);
}

}
Loading