Skip to content

Commit 49f8069

Browse files
committed
BAPI-14373: Issue with Banner Ethos API Extensibility WRITE SQL (used for POST, PUT or DELETE) is being called on QAPI request
1 parent 4b13c35 commit 49f8069

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

RELEASE-NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#1.7.0
22
* Add setting overrideVersionRangeMediaType=true to allow override of a whole digit representation version number with the highest semantic version where the major version matches. This is in support of version ranges that facilitate easier caller adoption of non-breaking API changes. This feature requires an ApiVersionParser to be configured.
3+
* Correct extensibility to not execute WRITE SQL if the request is a POST /qapi request (this represents a query by post read-only request).
34

45
#1.6.0
56
* Add support for specifying optional metadata at the representation level of a resource definition.

grails-app/controllers/net/hedtech/restfulapi/RestfulApiController.groovy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,9 @@ class RestfulApiController {
397397
}
398398
holder.addHeader(pageOffsetHeader, requestParams.offset ? requestParams?.offset : 0)
399399
holder.addHeader(pageMaxHeader, requestParams.max ? requestParams?.max : result.size())
400+
if (request.method == "POST") {
401+
holder.isQapi = true
402+
}
400403
renderSuccessResponse( holder, 'default.rest.list.message' )
401404
}
402405
}
@@ -745,7 +748,7 @@ class RestfulApiController {
745748
// optional: perform content extension post representation
746749
if (restContentExtensions && isExtensibleContent(content, contentType)) {
747750
log.trace("Extending content for resource=$params.pluralizedResourceName with contentType=$contentType")
748-
def result = restContentExtensions.applyExtensions(params.pluralizedResourceName, request, params, content)
751+
def result = restContentExtensions.applyExtensions(params.pluralizedResourceName, request, params, content, responseHolder.isQapi)
749752
if (result.extensionsApplied) {
750753
content = result.content
751754
}

src/groovy/net/hedtech/restfulapi/ContentExtensions.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ***************************************************************************
2-
* Copyright 2017 Ellucian Company L.P. and its affiliates.
2+
* Copyright 2017-2018 Ellucian Company L.P. and its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,6 @@ interface ContentExtensions {
2727
/**
2828
* Apply extensions to content.
2929
**/
30-
def ContentExtensionResult applyExtensions(String resourceName, def request, Map requestParams, def content) throws Throwable
30+
def ContentExtensionResult applyExtensions(String resourceName, def request, Map requestParams, def content, def isQapi) throws Throwable
3131

3232
}

src/groovy/net/hedtech/restfulapi/ResponseHolder.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* ***************************************************************************
2-
* Copyright 2013 Ellucian Company L.P. and its affiliates.
2+
* Copyright 2013-2018 Ellucian Company L.P. and its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ class ResponseHolder {
2020
Object data
2121
def headers = [:]
2222
def message
23+
def isQapi = false
2324

2425
void addHeader( String name, Object value ) {
2526
if (!headers[name]) {

0 commit comments

Comments
 (0)