发布 v1.10 #5
@@ -6,6 +6,7 @@ import com.easyagents.flow.core.chain.runtime.ChainExecutor;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.easyflow.approval.annotation.RequirePublishedAccess;
|
||||
import tech.easyflow.ai.easyagentsflow.entity.ChainInfo;
|
||||
@@ -38,7 +39,7 @@ import java.util.Map;
|
||||
/**
|
||||
* 工作流
|
||||
*/
|
||||
@RequestMapping("/public-api/workflow")
|
||||
@RequestMapping(value = "/public-api/workflow", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RestController
|
||||
public class PublicWorkflowController {
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package tech.easyflow.publicapi.controller;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* {@link PublicWorkflowController} HTTP 响应契约测试。
|
||||
*/
|
||||
public class PublicWorkflowControllerContractTest {
|
||||
|
||||
/**
|
||||
* 验证工作流公共 API 明确返回 JSON,避免通配 Accept 请求被 CBOR 转换器接管。
|
||||
*/
|
||||
@Test
|
||||
public void shouldDeclareJsonResponseMediaType() {
|
||||
RequestMapping requestMapping = PublicWorkflowController.class.getAnnotation(RequestMapping.class);
|
||||
|
||||
Assert.assertNotNull(requestMapping);
|
||||
Assert.assertArrayEquals(
|
||||
new String[]{MediaType.APPLICATION_JSON_VALUE},
|
||||
requestMapping.produces()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user